c#中 怎样才能common的gettype方法

2025-06-24 15:26:19
推荐回答(1个)
回答1:

1
2
3
4
5
6
7
8
通过PropertyInfo类的PropertyType属性判断
foreach (PropertyInfo pi in propertys)
{
//判断属性是否为bool类型
if (pi.PropertyType == typeof(bool))
{
}
}