Beispiel #1
0
        public Delegate GetOrCreateConstructorCall(Type assembledType, Type delegateType, bool allowNonPublic)
        {
            ArgumentUtility.CheckNotNull("assembledType", assembledType);
            ArgumentUtility.CheckNotNullAndTypeIsAssignableFrom("delegateType", delegateType, typeof(Delegate));

            var reverseConstructionKey = new ConstructorForAssembledTypeCacheKey(assembledType, delegateType, allowNonPublic);

            return(_constructorCalls.GetOrAdd(reverseConstructionKey, _createConstructorCallFunc));
        }
Beispiel #2
0
        private Delegate CreateConstructorCall(ConstructorForAssembledTypeCacheKey key)
        {
            var requestedType = _typeAssembler.GetRequestedType(key.AssembledType);

            return(_constructorDelegateFactory.CreateConstructorCall(requestedType, key.AssembledType, key.DelegateType, key.AllowNonPublic));
        }