using System.Collections.Generic; namespace Quadarax.Foundation.Core.Object.Extensions { public static class ObjectExt { public static IDictionary GetAllPropertyValues(this object obj) { var props = new Dictionary(); if (obj == null) return props; var type = obj.GetType(); foreach (var prop in type.GetProperties()) { var val = prop.GetValue(obj, new object[] { }); props.Add(prop.Name, val); } return props; } } }