C# JSON轉為字符串


//Deserialize<T>(String)   將JSON字符串轉化為類型T。

JavaScriptSerializer jss = new JavaScriptSerializer(); IList<IDictionary<string, string>> remarkContent = jss.Deserialize<IList<IDictionary<string, string>>>("字符串"); remarkContent = remarkContent == null ? new List<IDictionary<string, string>>() : remarkContent; IDictionary<string, string> _contentlist = new Dictionary<string, string>();


//向集合添加新的數據

_contentlist["Remark"] = Remark; _contentlist["CreateDate"] = timenow.ToString(); _contentlist["CreateBy"] = username; remarkContent.Add(_contentlist);

 

//轉為字符串

remarkList = jss.Serialize(remarkContent);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM