RestBucks.Infrastructure.Linking.ResourceLinker.ToDictionary C# (CSharp) Method

ToDictionary() private static method

private static ToDictionary ( object anonymousInstance ) : string>.IDictionary
anonymousInstance object
return string>.IDictionary
        private static IDictionary<string, string> ToDictionary(object anonymousInstance)
        {
            var dictionary = anonymousInstance as IDictionary<string, string>;
              if (dictionary != null) return dictionary;

              return TypeDescriptor.GetProperties(anonymousInstance)
            .OfType<PropertyDescriptor>()
            .ToDictionary(p => p.Name, p => p.GetValue(anonymousInstance).ToString());
        }