/// <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); }
public void EmitAttribute (ConstructorBuilder builder) { if (ResolveBuilder ()) builder.SetCustomAttribute (cab); }
/// <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); }
private void EmitCustomAttributes(ConstructorBuilder ctorBuilder, IEnumerable<Cci.ICustomAttribute> attributes) { foreach (var attribute in attributes) { ctorBuilder.SetCustomAttribute(CreateCustomAttributeBuilder(attribute)); } }
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); }
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); } } } }