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)
            {
            }
        }
    }
}
posted @ 2021-09-30 17:08  673613920  阅读(11)  评论(0编辑  收藏  举报