Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verification on cloning
Message
De
10/12/2014 00:25:24
 
 
À
09/12/2014 23:13:58
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:
01612080
Vues:
46
>That can be implemented in the Data class
>In the Clone() method - first do the MemberWiseClone(), then copy the dataset
>http://msdn.microsoft.com/en-us/library/system.icloneable(v=vs.110).aspx
>
>
>Notes to Implementers
>The ICloneable interface simply requires that your implementation of the Clone method return a copy of the current object instance. It does not specify whether the cloning operation performs a deep copy, a shallow copy, or something in between.
>

>
>
>	class Test_Clone
>	{
>		internal static void Go()
>		{
>
>			Data d = new Data();
>			// do some changes to d.oDataSet
>
>			Data cloned = d.Clone() as Data;
>		}
>	}
>
>	class Data : ICloneable
>	{
>		internal DataSet oDataSet = new DataSet();
>		internal int Count = 4;
>
>		public object Clone()
>		{
>			Data cloned = (Data) MemberwiseClone();
>			cloned.oDataSet = cloned.oDataSet.Copy();
>
>			return cloned;
>		}
>	}
>
That is a very interesting approach. Thanks
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