Boo.Lang.Compiler.Steps.EmitAssembly.GetMappedConstructorInfo C# (CSharp) Метод

GetMappedConstructorInfo() приватный Метод

Retrieves the ConstructorInfo for a constructor as mapped on a generic type.
private GetMappedConstructorInfo ( IType targetType, IConstructor source ) : ConstructorInfo
targetType IType
source IConstructor
Результат System.Reflection.ConstructorInfo
        private ConstructorInfo GetMappedConstructorInfo(IType targetType, IConstructor source)
        {
            ConstructorInfo ci = GetConstructorInfo(source);
            if (!ci.DeclaringType.IsGenericTypeDefinition)
            {
                // HACK: .NET Reflection doesn't allow calling
                // TypeBuilder.GetConstructor(Type, ConstructorInfo) on types that aren't generic
                // definitions, so we have to manually find the corresponding ConstructorInfo on the
                // declaring type's definition before mapping it
                Type definition = ci.DeclaringType.GetGenericTypeDefinition();
                ci = Array.Find<ConstructorInfo>(
                    definition.GetConstructors(),
                    delegate(ConstructorInfo other) { return other.MetadataToken == ci.MetadataToken; });
            }

            return TypeBuilder.GetConstructor(GetSystemType(targetType), ci);
        }
EmitAssembly