RestBucks.Infrastructure.Linking.ResourceLinker.ToDictionary C# (CSharp) 메소드

ToDictionary() 개인적인 정적인 메소드

private static ToDictionary ( object anonymousInstance ) : string>.IDictionary
anonymousInstance object
리턴 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());
        }