C#当中获取属性有种情况为,该属性没有get和set函数,则该属性非属性,实际为字段。因此需要使用以下方法来获取:
Type type = typeof(YourClass);
string propertyName = "yourField";
const BindingFlags InstanceBindFlags = | | ;
while (type != null)
{
property = (propertyName, InstanceBindFlags);
if (property != null)
{
break;
}
}
int value = (int)();
以上