Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verification on cloning
Message
De
10/12/2014 10:45:16
 
 
À
10/12/2014 10:00:08
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:
01612101
Vues:
45
>>Do you really need a copy. Can't you just create a new one with the copied DataTable ?
>
>I found that the other issue I am having is that:
>
>
>    ' 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()
>
>        Return loData
>    End Function
>
>
>...this does not copy the dataset as is. It gives all kind of various errors as soon as I add that line. If I return before the dataset line, I do not have the error, but, of course, the dataset is not cloned and if the client class cloned object changes the dataset, then I have problems. This is why I need to find a proper way to clone the dataset as well. Would you know why that line you suggested does not provide the same image as the base object dataset?



No idea - depends on the error


>>Because they found it started to get (too) complicated.
>
>What we have now is a shallow copy. But, I see many are requesting the support of a deep copy. It wouldn't have to be the default. But, at least, the ability to pass a parameter to get a deep copy would be useful.
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform