Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verification on cloning
Message
De
10/12/2014 09:54:16
 
 
À
10/12/2014 09:32:22
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:
01612097
Vues:
47
>>I think oDataTable is null. If it is, you cannot copy it. Only copy if oDataTable is not null
>
>Ok, so far so good, I now 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()
>
>        ' If we have oDataTable
>        If Not loData.oDataTable Is Nothing Then
>            loData.oDataTable = loData.oDataTable.Copy()
>        End If
>
>        Return loData
>    End Function
>
>
>But, I assume I have to handle those ones:
>
>
>    Public oDataView As DataView = Nothing
>    Public oRow As DataRow = Nothing
>    Public oRowInitial As DataRow = Nothing
>    Public oRows As DataRowCollection = Nothing
>
>
>And, oDataView does not offer a copy. It starts to get complicated.

Do you really need a copy. Can't you just create a new one with the copied DataTable ?

>I really do not understand why a full cloning is not supported.

Because they found it started to get (too) complicated.
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform