[Serializable]
public class ContentModel
{
   public int ContentId { get; set; }
   public string HeaderRendered { get; set; }
   public ContentModel()
   {
       ContentId = 0;
       HeaderRendered = string.Empty;
   }
   public ContentModel(SerializationInfo info, StreamingContext ctxt)
   {
       ContentId = (int)info.GetValue("ContentId", typeof(int));
       HeaderRendered = (string)info.GetValue("HeaderRendered", typeof(string));
   }
   public void GetObjectData(SerializationInfo info, StreamingContext context)
   {
       info.AddValue("ContentId ", ContentId);
       info.AddValue("HeaderRendered", HeaderRendered);
   }
}
Saturday, October 2, 2010
Simpler way to Serializing objects in C# 4.0
ป้ายกำกับ:
Serializable C# C# 4
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment