ISerializable
using System;
using System.Text;
using System.IO;
// Add references to Soap and Binary formatters.
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization.Formatters.Soap ;
using System.Runtime.Serialization;
[Serializable]
public class Serializable : ISerializable
{
public Serializable()
{
// Empty constructor required to compile.
}
// 逆シリアライズ用のコンストラクタ
public MyItemType(SerializationInfo info, StreamingContext context)
{
this.Property = (string)info.GetValue("Property", typeof(string));
}
public string Property { get; set; }
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Property", this.Property, typeof(string));
}
}