您的位置:首页 > 其它

.net 序列化数据对象

2008-03-06 16:58 274 查看
.net 序列化数据对象到XML,XML反序列化为对象

呵呵... 直接放代码

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

using System.Xml;

using System.Xml.Serialization;

namespace ConsoleApplication2

[Serializable]

public class StockTicker

{

private string _instrumentType;

[XmlAttribute]

public string InstrumentType

{

get { return _instrumentType; }

set { _instrumentType = value; }

}

private string _userSymbol;

[XmlAttribute]

public string UserSymbol

{

get { return _userSymbol; }

set { _userSymbol = value; }

}

private int _seq;

[XmlAttribute]

public int Seq

{

get { return _seq; }

set { _seq = value; }

}

private int _msgType;

[XmlAttribute]

public int MsgType

{

get { return _msgType; }

set { _msgType = value; }

}

private int _bidSize;

[XmlAttribute]

public int BidSize

{

get { return _bidSize; }

set { _bidSize = value; }

}

private int _askSize;

[XmlAttribute]

public int AskSize

{

get { return _askSize; }

set { _askSize = value; }

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: