using DevComponents.DotNetBar;
using MyControl;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
using System.Windows.Forms; namespace InternetDis
{
public class clsSystem
{
public static T JsonStringToCls<T>(string JsonStr)
{
StringReader strReader = new StringReader(JsonStr);
T clsObj = (T)(new JsonSerializer()).Deserialize(new JsonTextReader(strReader), typeof(T));
return clsObj;
}
}   public class JsonResult
{
public string result { get; set; }
public string description { get; set; }
}
}

调用方法:

JsonResult JsonRst = new JsonResult() { result = "-1" };
StreamReader reader = new StreamReader(stream);
string strRst = reader.ReadToEnd();
JsonRst = clsSystem.JsonStringToCls<JsonResult>(strRst);

需要添加 Newtonsoft.Json.dll 引用!

最新文章

  1. Android开发学习—— ContentProvider内容提供者
  2. 东大OJ-1040-Count-快速幂方法求解斐波那契-
  3. 安装ubuntu和安装ubuntu后要安装的软件列表
  4. 两种不同png图片的在项目中的运用
  5. 使用Spring的注解方式实现AOP
  6. Lintcode: Majority Number II
  7. Git客户端TortoiseGit(Windows系统)的使用方法
  8. WCF服务的创建和发布到IIS
  9. windows store app promise
  10. Objective C 链式调用
  11. 不忘初心 --- 重读&lt;&lt;The C Programming Language&gt;&gt;
  12. Linux入门之常用命令(11) 系统监控 vmstat top
  13. python的枚举
  14. Kibana安全特性之权限控制
  15. Ordering Tasks
  16. Spring各个jar包作用
  17. 第三个Sprint冲刺第八天(燃尽图)
  18. scala-泛型
  19. Selenium+Java自动化测试的方法
  20. Unity中进程间通信——使用异步Socket

热门文章

  1. Web端导出CSV
  2. 用于主题检测的临时日志(431b1c14-8b75-4f42-994f-cfda72208c10 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)
  3. C#Light(包括unity一切C#环境可用嵌入式脚本)0.10B稳定版发布,功能已定型
  4. java加密-解密小结
  5. WebViewJavascriptBridge的暂时理解
  6. Android开发学习之路-Android Design Support Library使用(CoordinatorLayout的使用)
  7. atitit &#160;opencv apiattilax总结&#160;约500个函数 .xlsx
  8. tabs左右滚动
  9. vue-cli创建项目
  10. 查看Wait type