Monday, 21 October 2019

Converting object to Dictionary - C#

someObject.GetType()
     .GetProperties(BindingFlags.Instance | BindingFlags.Public)
          .ToDictionary(prop => prop.Name, prop => prop.GetValue(someObject, null))

No comments:

Post a Comment