/ Published in: C#

Expand |
Embed | Plain Text
public DataTable DeepCopy(DataTable TargetTable) { DataTable copyTable = null; // コピー元オブジェクトをシリアライズã—ã¾ã™ã€‚ System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); formatter.Serialize(stream, TargetTable); stream.Position = 0; // シリアライズデータをコピー先オブジェクトã«ãƒ‡ã‚·ãƒªã‚¢ãƒ©ã‚¤ã‚ºã—ã¾ã™ã€‚ copyTable = (DataTable)formatter.Deserialize(stream); return copyTable; }
You need to login to post a comment.