Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verification on cloning
Message
De
10/12/2014 09:22:42
 
 
À
10/12/2014 09:13:23
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:
01612094
Vues:
38
>>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.

I think oDataTable is null. If it is, you cannot copy it. Only copy if oDataTable is not null
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform