契约类指继承了:datacontract的类。契约类常在wcf,webservice等各种服务中作为传输数据使用。
凡是契约类或者继承了契约类的类,如果想要属性参与序列化与反序列化,需要在属性上加上标记:DataMember
如:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.Serialization;namespace SinoOcean.Seagull2.Framework.Contracts.Fund
{
[DataContract]public class SubAccountItemContract
{#region 属性/// /// 账号/// [DataMember]public string AccountNumber { get; set; }/// /// 金额/// [DataMember]public decimal Money { get; set; }
}
}









