日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

Json數(shù)據(jù)轉(zhuǎn)換list對象實現(xiàn)思路及代碼_.Net教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:asp.net服務(wù)器端指令include的使用及優(yōu)勢介紹
將指定文件的內(nèi)容插入 ASP.NET 文件中,包括網(wǎng)頁(.aspx 文件)、用戶控件文件(.ascx 文件)和 Global.asax 文件

JSON代碼
復(fù)制代碼 代碼如下:hl5o.cn

[{"cId":2,"cName":"\u767d\u841d\u535c","amount":26,"

VS2008
引用System.ServiceModel.Web.dll
引用System.Runtime.Serialization.dll
復(fù)制代碼 代碼如下:hl5o.cn

private void Form1_Load(object sender, EventArgs e)
{
string _JsonText = System.IO.File.ReadAllText(@"C:\2.TXT");
List<Test> _Test = new List<Test>();
DataContractJsonSerializer _Json = new DataContractJsonSerializer(_Test.GetType());
byte[] _Using = System.Text.Encoding.UTF8.GetBytes(_JsonText);
System.IO.MemoryStream _MemoryStream = new System.IO.MemoryStream(_Using);
_MemoryStream.Position = 0;
_Test =(List<Test>)_Json.ReadObject(_MemoryStream);
}
public class Test
{
public int cId = 0;
public string cName = "";
public int amount = 0;
public string price = "";
}

分享:關(guān)于.NET的集合總結(jié)
集合是一些有共同特征的獨立數(shù)據(jù)項組成的,通過集合,我們可以可以使用相同的調(diào)用代碼來處理一個集合的所有元素,而不用單獨處理每一個單獨的項

來源:模板無憂//所屬分類:.Net教程/更新時間:2013-04-24
相關(guān).Net教程