/// <summary> /// Obtains cached constructor info or creates a new entry, if none is found. /// </summary> private static ConstructorDelegate GetOrCreateDynamicConstructor(ConstructorInfo constructorInfo) { ConstructorDelegate method; if (!constructorCache.TryGetValue(constructorInfo, out method)) { method = DynamicReflectionManager.CreateConstructor(constructorInfo); lock (constructorCache) { constructorCache[constructorInfo] = method; } } return(method); }
/// <summary> /// Obtains cached constructor info or creates a new entry, if none is found. /// </summary> private static ConstructorDelegate GetOrCreateDynamicConstructor(ConstructorInfo constructorInfo) { ConstructorDelegate method = (ConstructorDelegate)constructorCache[constructorInfo]; if (method == null) { method = DynamicReflectionManager.CreateConstructor(constructorInfo); lock (constructorCache) { constructorCache[constructorInfo] = method; } } return(method); }