///
/// Clones any object and returns the new cloned object.
///
///
///
The original object.///
public static T Clone
{
var dcs = new DataContractSerializer(typeof(T));
using (var ms = new System.IO.MemoryStream())
{
dcs.WriteObject(ms, source);
ms.Seek(0, System.IO.SeekOrigin.Begin);
return (T)dcs.ReadObject(ms);
}
}
source:http://stackoverflow.com/questions/2178080/linq-to-sql-copy-original-entity-to-new-one-and-save
clone linq object
Gönderen
pantepember
24 Ocak 2011 Pazartesi
Etiketler: DataContractSerializer , linq