using System.Collections.Generic;
public string Name { get; set; } = "John Doe";
public int Age { get; set; } = 42;
public static void Main()
Test instance = new Test();
Type type = typeof (Test);
Dictionary<string, object> properties = new Dictionary<string, object>();
foreach (PropertyInfo prop in type.GetProperties())
properties.Add(prop.Name, prop.GetValue(instance));