Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Verification on cloning
Message
From
10/12/2014 09:22:42
 
 
To
10/12/2014 09:13:23
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01612064
Message ID:
01612094
Views:
40
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform