andrew4582

GetPropertyValues

Sep 7th, 2012
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.25 KB | None | 0 0
  1.         public static Dictionary<string, object> GetPropertyValues(object obj)
  2.         {
  3.             var dictionary = TypeDescriptor.GetProperties(obj)
  4.               .OfType<PropertyDescriptor>()
  5.               .ToDictionary(p => p.Name, p => p.GetValue(obj));
  6.             return dictionary;
  7.         }
Advertisement
Add Comment
Please, Sign In to add comment