public static IReflectionProperties Get(Type type) { lock (theLock) { if (cache == null) { cache = new Dictionary <Type, IReflectionProperties>(); } if (!cache.TryGetValue(type, out IReflectionProperties dict)) { dict = TypeHelper.GetPropertiesDict(type); cache.Add(type, dict); } return(dict); } }
/// <summary> /// Get the properties of a generic type. /// </summary> public static IReflectionProperties <T> GetProperties(Type type) { IReflectionProperties <T> properties; lock (typesDict) { if (!typesDict.ContainsKey(type)) { properties = TypeHelper.GetPropertiesDict <T>(type); typesDict.Add(type, properties); } else { properties = typesDict[type]; } } return(properties); }