/// <summary> /// Returns dynamic constructor if one exists. /// </summary> /// <param name="constructor">Constructor to look up.</param> /// <param name="createCallback">callback function that will be called to create the dynamic constructor</param> /// <returns>An <see cref="IDynamicConstructor" /> for the given constructor.</returns> internal static IDynamicConstructor GetDynamicConstructor(ConstructorInfo constructor, CreateConstructorCallback createCallback) { lock (_constructorCacheLock) { IDynamicConstructor dynamicConstructor; if (!_constructorCache.TryGetValue(constructor, out dynamicConstructor)) { dynamicConstructor = createCallback(constructor); _constructorCache[constructor] = dynamicConstructor; } return(dynamicConstructor); } }
/// <summary> /// Returns dynamic constructor if one exists. /// </summary> /// <param name="constructor">Constructor to look up.</param> /// <param name="createCallback">callback function that will be called to create the dynamic constructor</param> /// <returns>An <see cref="IDynamicConstructor"/> for the given constructor.</returns> internal static IDynamicConstructor GetDynamicConstructor(ConstructorInfo constructor, CreateConstructorCallback createCallback) { lock (constructorCache.SyncRoot) { IDynamicConstructor dynamicConstructor = (IDynamicConstructor)constructorCache[constructor]; if (dynamicConstructor == null) { dynamicConstructor = createCallback(constructor); constructorCache[constructor] = dynamicConstructor; } return dynamicConstructor; } }
/// <summary> /// Returns dynamic constructor if one exists. /// </summary> /// <param name="constructor">Constructor to look up.</param> /// <param name="createCallback">callback function that will be called to create the dynamic constructor</param> /// <returns>An <see cref="IDynamicConstructor" /> for the given constructor.</returns> internal static IDynamicConstructor GetDynamicConstructor(ConstructorInfo constructor, CreateConstructorCallback createCallback) { lock (_constructorCacheLock) { IDynamicConstructor dynamicConstructor; if (!_constructorCache.TryGetValue(constructor, out dynamicConstructor)) { dynamicConstructor = createCallback(constructor); _constructorCache[constructor] = dynamicConstructor; } return dynamicConstructor; } }
/// <summary> /// Returns dynamic constructor if one exists. /// </summary> /// <param name="constructor">Constructor to look up.</param> /// <param name="createCallback">callback function that will be called to create the dynamic constructor</param> /// <returns>An <see cref="IDynamicConstructor"/> for the given constructor.</returns> internal static IDynamicConstructor GetDynamicConstructor(ConstructorInfo constructor, CreateConstructorCallback createCallback) { lock (constructorCache.SyncRoot) { IDynamicConstructor dynamicConstructor = (IDynamicConstructor)constructorCache[constructor]; if (dynamicConstructor == null) { dynamicConstructor = createCallback(constructor); constructorCache[constructor] = dynamicConstructor; } return(dynamicConstructor); } }