📜  从对象 c# 代码示例中获取属性值

📅  最后修改于: 2022-03-11 14:48:47.602000             🧑  作者: Mango

代码示例2
Type myType = myObject.GetType();
IList props = new List(myType.GetProperties());

foreach (PropertyInfo prop in props)
{
    object propValue = prop.GetValue(myObject, null);

    // Do something with propValue
}