C# Dynamic通用反序列化Json类型并遍历属性比较

上传者: hirisw | 上传时间: 2021-08-25 16:47:39 | 文件大小: 1.01MB | 文件类型: ZIP
个API结果比较的工具,比较的内容就是Json内容,但是为了实现宽泛的内容相等即只需要字段和值相等即可,不需要字符串严格相等,这种情况下就需要将Json内容字符串转换成具体的对象,出于通用性方面的考虑希望这个工具能比较所有的API结果不单单只是3D的API,所有在反序列化Json字符串时需要一种通用的转换方式,而不是写死的某个类的反序列化,这里介绍的一种思路就是使用dynamic关键字来实现通用反序列化并比较反序列化后的对象是否深度相等即比较对象的各个字段是否相等。深度相等通过两个方法一个字段相等和集合相等,字段相等区分字段名称和字段值是否相等,集合相等则将集合转换成元素,元素再比较字段相等,字段中包含集合的再递归调用实现。

文件下载

资源详情

[{"title":"( 41 个子文件 1.01MB ) C# Dynamic通用反序列化Json类型并遍历属性比较","children":[{"title":"3vjAPITester","children":[{"title":"3vjAPITester.csproj.user <span style='color:#111;'> 228B </span>","children":null,"spread":false},{"title":"FileHelper.cs <span style='color:#111;'> 8.18KB </span>","children":null,"spread":false},{"title":"Form1.cs <span style='color:#111;'> 25.02KB </span>","children":null,"spread":false},{"title":"bin","children":[{"title":"Debug","children":[{"title":"CategoryControllerLogs_20180415StatisticsResult.log <span style='color:#111;'> 187.14KB </span>","children":null,"spread":false},{"title":"3vjAPITester.vshost.exe.config <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"3vjAPITester.exe.config <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"Newtonsoft.Json.dll <span style='color:#111;'> 514.00KB </span>","children":null,"spread":false},{"title":"3vjAPITester.vshost.exe <span style='color:#111;'> 22.16KB </span>","children":null,"spread":false},{"title":"CategoryControllerLogs_20180415.log <span style='color:#111;'> 2.08MB </span>","children":null,"spread":false},{"title":"3vjAPITester.pdb <span style='color:#111;'> 83.50KB </span>","children":null,"spread":false},{"title":"3vjAPITester.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"3vjAPITester.exe <span style='color:#111;'> 49.00KB </span>","children":null,"spread":false}],"spread":true},{"title":"Release","children":null,"spread":false}],"spread":true},{"title":".vs","children":[{"title":"3vjAPITester","children":[{"title":"v14","children":[{"title":".suo <span style='color:#111;'> 3.50KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true},{"title":"obj","children":[{"title":"Debug","children":[{"title":"3vjAPITester.csprojResolveAssemblyReference.cache <span style='color:#111;'> 16.91KB </span>","children":null,"spread":false},{"title":"_3vjiaTool.Form1.resources <span style='color:#111;'> 488B </span>","children":null,"spread":false},{"title":"TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferences.cache <span style='color:#111;'> 1.43KB </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferencesInput.cache <span style='color:#111;'> 7.13KB </span>","children":null,"spread":false},{"title":"_3vjAPITester.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"3vjAPITester.pdb <span style='color:#111;'> 83.50KB </span>","children":null,"spread":false},{"title":"TempPE","children":null,"spread":false},{"title":"3vjAPITester.csproj.FileListAbsolute.txt <span style='color:#111;'> 1.36KB </span>","children":null,"spread":false},{"title":"TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"3vjAPITester.exe <span style='color:#111;'> 49.00KB </span>","children":null,"spread":false},{"title":"3vjAPITester.csproj.GenerateResource.Cache <span style='color:#111;'> 1012B </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"Properties","children":[{"title":"Resources.Designer.cs <span style='color:#111;'> 2.79KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 249B </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false},{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.40KB </span>","children":null,"spread":false}],"spread":true},{"title":"Program.cs <span style='color:#111;'> 533B </span>","children":null,"spread":false},{"title":"APITestEntity.cs <span style='color:#111;'> 334B </span>","children":null,"spread":false},{"title":"MethodExecuteInfo.cs <span style='color:#111;'> 1017B </span>","children":null,"spread":false},{"title":"ServiceHelper.CS <span style='color:#111;'> 31.01KB </span>","children":null,"spread":false},{"title":"Form1.Designer.cs <span style='color:#111;'> 20.94KB </span>","children":null,"spread":false},{"title":"3vjAPITester.csproj <span style='color:#111;'> 4.39KB </span>","children":null,"spread":false},{"title":"ServiceResult.CS <span style='color:#111;'> 1.74KB </span>","children":null,"spread":false},{"title":"App.config <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"Form1.resx <span style='color:#111;'> 6.02KB </span>","children":null,"spread":false},{"title":"ClassDiagram1.cd <span style='color:#111;'> 60B </span>","children":null,"spread":false},{"title":"ConstValueHelper.cs <span style='color:#111;'> 675B </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • t942054664 :
    没用,乱七八糟的代码。
    2019-06-28

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明