Boo.Lang.Compiler.TypeSystem.GenericConstructedType.GetConstructors C# (CSharp) Method

GetConstructors() public method

public GetConstructors ( ) : IConstructor[]
return IConstructor[]
        public IConstructor[] GetConstructors()
        {
            return Array.ConvertAll<IConstructor, IConstructor>(
                _definition.GetConstructors(),
                delegate(IConstructor c) { return GenericMapping.Map(c); });
        }

Usage Example

Example #1
0
        public MethodInvocationExpression CreateGenericConstructorInvocation(IType classType,
                                                                             IEnumerable <TypeReference> genericArgs)
        {
            var          gpp = classType as IGenericParametersProvider;
            IConstructor constructor;

            if (gpp == null || !genericArgs.Any())
            {
                constructor = classType.GetConstructors().First();
                return(CreateConstructorInvocation(constructor));
            }

            classType = new GenericConstructedType(
                classType,
                genericArgs.Select(a => a.Entity).Cast <IType>().ToArray());
            constructor = classType.GetConstructors().First();

            var result = new MethodInvocationExpression {
                Target = CreateReference(constructor.DeclaringType)
            };

            result.Target.Entity  = constructor;
            result.ExpressionType = constructor.DeclaringType;

            return(result);
        }