您的位置:首页 > 移动开发 > Objective-C

C# json object互转工具

2013-10-30 19:06 309 查看
public static T Deserializer<T>(string path)
{
try
{
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
xd.LoadXml(path);
MemoryStream stream = new MemoryStream();
xd.Save(stream);

XmlSerializer xml = new XmlSerializer(typeof(T));
//序列化对象
T t = (T)xml.Deserialize(stream);
stream.Close();
return t;
}
catch (InvalidOperationException)
{
throw;
}
catch (FileNotFoundException)
{ throw; }
finally
{

}
}


https://jsonclassgenerator.codeplex.com/

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