Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verification on cloning
Message
De
10/12/2014 09:13:23
 
 
À
10/12/2014 09:09:56
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01612064
Message ID:
01612093
Vues:
34
>An ArrayList( oParameters ) is a reference type
>
>If the ArrayList is not going to be changed - you can use the reference

Ok, so far I have this:
    ' Clone this object
    Public Function Clone() As Object Implements System.ICloneable.Clone
        Dim loData As Data = DirectCast(MemberwiseClone(), Data)

        ' Add to the cloning object the dataset as well
        ' MemberwiseClone only copies value types
        ' So just returning Return MyBase.MemberwiseClone() would not do if after the cloning the access to the original dataset is needed
        loData.oDataSet = loData.oDataSet.Copy()
        loData.oDataTable = loData.oDataTable.Copy()

        Return loData
    End Function
I had to evolve it as it was not working entirely as I have more properties that need to be cloned.

The oDataTable returns "Object reference not set to an instance of an object". This is on the second Copy here. I am not sure why that one cannot work.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform