契约类指继承了:DataContract的类。契约类常在WCF,webService等各种服务中作为传输数据使用。
凡是契约类或者继承了契约类的类,如果想要属性参与序列化与反序列化,需要在属性上加上标记:DataMember
如:
复制代码1
2
3
4
5
6
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 属性/// <summary>/// 账号/// </summary> [DataMember]public string AccountNumber { get; set; }/// <summary>/// 金额/// </summary> [DataMember]public decimal Money { get; set; }
}
}
登录后复制
以上就是契约类相关的序列化与反序列化实例详解的详细内容,更多请关注靠谱客其它相关文章!
最后
以上就是复杂鸡翅最近收集整理的关于契约类相关的序列化与反序列化实例详解的全部内容,更多相关契约类相关内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复