예제 #1
0
 public void BuildAttribute(TypeBuilder builder, IList <Attribute> attributes)
 {
     foreach (var attribute in attributes)
     {
         var customAttributeBuilder = CustomAttributeBuilderFactory.Build(attribute);
         if (customAttributeBuilder != null)
         {
             builder.SetCustomAttribute(customAttributeBuilder);
         }
     }
 }
예제 #2
0
 public MethodBuilder BuildAttribute(MethodBuilder builder, IList <Attribute> attributes)
 {
     foreach (var attribute in attributes)
     {
         var customAttributeBuilder = CustomAttributeBuilderFactory.Build(attribute);
         if (customAttributeBuilder != null)
         {
             builder.SetCustomAttribute(customAttributeBuilder);
         }
     }
     return(builder);
 }
예제 #3
0
        public MethodBuilder BuildParameter(MethodBuilder builder, ParameterModel context)
        {
            var paramBuilder = builder.DefineParameter(context.Position, context.ParameterAttributes, context.ParameterName);

            if (context.HasDefaultValue)
            {
                paramBuilder.SetConstant(context.DefaultValue);
            }
            foreach (var attr in context.Attributes)
            {
                var customAttributeBuilder = CustomAttributeBuilderFactory.Build(attr);
                if (customAttributeBuilder != null)
                {
                    paramBuilder.SetCustomAttribute(customAttributeBuilder);
                }
            }
            return(builder);
        }