Пример #1
0
        public IPropertyLambda Property(Type returnType, string name, CallingConventions callingConventions)
        {
            var property = new TypeBuilderExtension(this.ModuleLambda.ModuleBuilder, this.TypeBuilder)
                           .CreateProperty(name, PropertyAttributes.HasDefault, returnType, null, callingConventions);

            return(new PropertyLambda(this, property));
        }
Пример #2
0
        public ICodeLambda Method(Type returnType, string name, Type[] argumentsTypes, MethodInfo parentMethodInfo)
        {
            var method = new TypeBuilderExtension(null, this.TypeBuilder)
                         .CreateMethod(this.methodAccessor.MethodAttribute, returnType, name, argumentsTypes, null, methodAccessor.IsOverride);


            return(new MethodOperand(this, method.GetILGenerator(), method.GetBaseDefinition()));
        }
Пример #3
0
        public ICodeLambda Constructor(IEnumerable <ParameterCriteriaMetadataInfo> parameterCriteriaMetadataInfos)
        {
            var constructorBuilder = new TypeBuilderExtension(this.ModuleLambda.ModuleBuilder, this.TypeBuilder)
                                     .CreateConstructor(this.methodAccessor.MethodAttribute, CallingConventions.HasThis, parameterCriteriaMetadataInfos);

            ResetAccessorAttributes();

            return(new CodeLambda(this, constructorBuilder.GetILGenerator()));
        }
Пример #4
0
        public ICodeLambda Constructor(params Type[] argumentsTypes)
        {
            var constructorBuilder = new TypeBuilderExtension(this.ModuleLambda.ModuleBuilder, this.TypeBuilder)
                                     .CreateConstructor(this.methodAccessor.MethodAttribute, CallingConventions.HasThis, argumentsTypes);

            ResetAccessorAttributes();

            return(new CodeLambda(this, constructorBuilder.GetILGenerator()));
        }
Пример #5
0
        public ICodeLambda Get()
        {
            var type       = new TypeBuilderExtension(null, this.TypeLambda.TypeBuilder);
            var methodAttr = this.TypeLambda.MethodAccessor.MethodAttribute | MethodAttributes.NewSlot | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.SpecialName | MethodAttributes.HideBySig;
            var method     = type.CreateMethod(methodAttr, propertyBuilder.PropertyType, String.Concat("get_", propertyBuilder.Name), Type.EmptyTypes, null, false);

            propertyBuilder.SetGetMethod(method);

            return(new CodeLambda(this.TypeLambda, method.GetILGenerator()));
        }
Пример #6
0
        public ICodeLambda Set()
        {
            var type = new TypeBuilderExtension(null, this.TypeLambda.TypeBuilder);

            var methodAttr = this.TypeLambda.MethodAccessor.MethodAttribute | MethodAttributes.NewSlot | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.SpecialName | MethodAttributes.HideBySig;
            var method     = type.CreateMethod(methodAttr, typeof(void), String.Concat("set_", propertyBuilder.Name), new Type[] { propertyBuilder.PropertyType }, null, false);

            method.DefineParameter(1, ParameterAttributes.HasDefault, "value");

            propertyBuilder.SetSetMethod(method);

            return(new CodeLambda(this.TypeLambda, method.GetILGenerator()));
        }