C# 反射

反射

PropertyInfo[] piDevice = device.GetType().GetProperties();
foreach (PropertyInfo item in piDevice)
{
  if (item.Name == "aaa")
    {
        if (item.GetValue(device, null) != null)
        {
            string a = item.GetValue(device, null).ToString();
            if (a == 100)
            {
            }
        }
    }
}
原文地址:https://www.cnblogs.com/qq673613920/p/15357588.html