loop over object properties c#

46

loop over object properties c# -

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

Comments

Submit
0 Comments