比较使用JSON C#对象 [英] Comparing C# objects using Json

查看:138
本文介绍了比较使用JSON C#对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想不实现equals()方法来比较两个对象



什么是他们以这种方式进行比较的缺点:
1. serilizing他们使用JSON
2.比较结果



谢谢!


解决方案

什么是他们以这种方式


$速度乙
$ b

损失进行比较的缺点。变换对象为JSON字符串,然后比较它们比地产做一个属性等于慢得多。



实施等于()始终是比较平等的两个对象的最佳方式。


I want to compare two objects without implementing the Equals() method.

What are the downsides of comparing them in this way: 1. serilizing them with Json 2. comparing the results

thanks!

解决方案

What are the downsides of comparing them in this way

Loss of speed. Transforming objects into JSON strings and then comparing them is much slower than doing a property by property equals.

Implementing Equals() is always the best way to compare two objects for equality.

这篇关于比较使用JSON C#对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆