日期:2014-05-18 浏览次数:21124 次
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有完全一样的属性名集合。但是不保证类型一样。你可以完善这个代码。
}