📜  循环对象属性 c# 代码示例

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

代码示例1
foreach (PropertyInfo prop in someObject.GetType().GetProperties())
{
    Console.WriteLine($"{prop.Name}: {prop.GetValue(someObject, null)}");
}