| 1234567891011121314151617181920212223 |
- using System.Collections.Generic;
- namespace Quadarax.Foundation.Core.Object.Extensions
- {
- public static class ObjectExt
- {
- public static IDictionary<string, object> GetAllPropertyValues(this object obj)
- {
- var props = new Dictionary<string, object>();
- 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;
- }
- }
- }
|