public class Config(){
public bool IsShowGli
}
Config model = new Config();
string item = "IsShowGli";
System.Reflection.PropertyInfo _Property = model.GetType().GetProperty(item);
if (_Property != null && _Property.CanWrite)
{
Type PropertyType = _Property.GetType();
if (PropertyType.Name == "Boolean")
{
bool thisbool = false;
bool.TryParse("true", out thisbool);
_Property.SetValue(model, thisbool, null);
}
}
下表显示内置 C# 类型的关键字,即 System 命名空间中预定义类型的别名。
如有不全请大家自行断点