SetCustomAttribute() public method

public SetCustomAttribute ( System customBuilder ) : void
customBuilder System
return void
		/// <summary>
		/// Initializes a new instance of the <see cref="ConstructorBuilder"/> class
		/// with the specified parameters.
		/// </summary>
		/// <param name="typeBuilder">Associated <see cref="TypeBuilderHelper"/>.</param>
		/// <param name="constructorBuilder">A <see cref="ConstructorBuilder"/></param>
		public ConstructorBuilderHelper(TypeBuilderHelper typeBuilder, ConstructorBuilder constructorBuilder)
			: base(typeBuilder)
		{
			if (constructorBuilder == null) throw new ArgumentNullException("constructorBuilder");

			_constructorBuilder = constructorBuilder;
			_constructorBuilder.SetCustomAttribute(Type.Assembly.BLToolkitAttribute);
		}
Esempio n. 2
0
		public void EmitAttribute (ConstructorBuilder builder)
		{
			if (ResolveBuilder ())
				builder.SetCustomAttribute (cab);
		}
Esempio n. 3
0
 /// <summary>
 /// Adds a <see cref="DebuggerHiddenAttribute"/> to a constructor.
 /// </summary>
 /// <param name="constructor">The constructor to add the attribute.</param>
 private static void AddDebuggerHiddenAttribute(ConstructorBuilder constructor)
 {
     Type attributeType = typeof(DebuggerHiddenAttribute);
     CustomAttributeBuilder attribute = new CustomAttributeBuilder(attributeType.GetConstructor(new Type[0]), new object[0]);
     constructor.SetCustomAttribute(attribute);
 }
Esempio n. 4
0
 private void EmitCustomAttributes(ConstructorBuilder ctorBuilder, IEnumerable<Cci.ICustomAttribute> attributes)
 {
     foreach (var attribute in attributes)
     {
         ctorBuilder.SetCustomAttribute(CreateCustomAttributeBuilder(attribute));
     }
 }
Esempio n. 5
0
 public static void SetCustomAttributes(ConstructorBuilder cb, IPersistentMap attributes)
 {
     foreach (CustomAttributeBuilder cab in CreateCustomAttributeBuilders(attributes))
         cb.SetCustomAttribute(cab);
 }
 private static void AddDebuggerHiddenAttribute(ConstructorBuilder constructor)
 {
     var type = typeof(DebuggerHiddenAttribute);
     var customBuilder = new CustomAttributeBuilder(type.GetConstructor(new Type[0]), new object[0]);
     constructor.SetCustomAttribute(customBuilder);
 }
Esempio n. 7
0
 internal static void DefineCustomAttributes(ConstructorBuilder member, ReadOnlyCollection<AttributeAst> attributes, Parser parser, AttributeTargets attributeTargets)
 {
     if (attributes != null)
     {
         foreach (var attr in attributes)
         {
             var cabuilder = GetAttributeBuilder(parser, attr, attributeTargets);
             if (cabuilder != null)
             {
                 member.SetCustomAttribute(cabuilder);
             }
         }
     }
 }