1
MY JSONC#的Json解析與Newtonsoft.Json
{"Players": [{"UserId": "76561198160689142"},{"UserId": "76561198160689123"},{"UserId": "76561198160689145"},{"UserId": "76561198160689144"}]}
,我sucess上反序列化
JsonOxide obj = JsonConvert.DeserializeObject<JsonOxide>(jsonread);
foreach(var item in obj.Players)
{
MessageBox.Show(item.UserId);
}
類JsonOxide.cs(我使用json2csharp使代碼)
public class Player
{
public string UserId { get; set; }
}
public class JsonOxide
{
public List<Player> Players { get; set; }
}
我想序列化我的Listview項目,所以我嘗試像這樣的代碼,但我不知道 如何序列化
List<JsonOxide> jolist = new List<JsonOxide>();
var objs = new Object[]
{
//wrong code
}
JsonOxide jo = new JsonOxide();
〔實施例
listivewitem 1.text = "test"
listviewitem 2.text = "test2"
will be save { "userid": "test"},{ "userid": "test2"}
和 listivew項目,如果ListViewItem的1被刪除將編輯JSON 刪除用戶名:測試值是如何做到這一點?