iterate through all properties of an object c# code example
Example: loop over object properties c#
foreach (PropertyInfo prop in someObject.GetType().GetProperties())
{
Console.WriteLine($"{prop.Name}: {prop.GetValue(someObject, null)}");
}
foreach (PropertyInfo prop in someObject.GetType().GetProperties())
{
Console.WriteLine($"{prop.Name}: {prop.GetValue(someObject, null)}");
}