111,126
社区成员
发帖
与我相关
我的任务
分享if (typeof(ClassA).GetProperties().Select(x => x.Name).Except(typeof(ClassB).GetProperties().Select(x => x.Name)).Count() == 0 && typeof(ClassB).GetProperties().Select(x => x.Name).Except(typeof(ClassA).GetProperties().Select(x => x.Name)).Count() == 0)
{
//说明ClassA和ClassB有完全一样的属性名集合。但是不保证类型一样。你可以完善这个代码。
}