22 lines
662 B
C#
22 lines
662 B
C#
using Newtonsoft.Json.Linq;
|
|
|
|
namespace SGModule.Common.Helper {
|
|
// 混合通用方法工具类(放置一些通用的静态函数)
|
|
public static class CommonUtils {
|
|
/// <summary>
|
|
/// 深度比较两个对象是否相等,支持复杂结构(如 List、Dictionary、嵌套对象)
|
|
/// </summary>
|
|
public static bool DeepEquals<T>(T a, T b) {
|
|
if (a == null && b == null) {
|
|
return true;
|
|
}
|
|
|
|
if (a == null || b == null) {
|
|
return false;
|
|
}
|
|
|
|
return JToken.DeepEquals(JToken.FromObject(a), JToken.FromObject(b));
|
|
}
|
|
}
|
|
}
|