System.Reflection.Emit.TypeBuilder.SetCustomAttribute C# (CSharp) Method

SetCustomAttribute() public method

public SetCustomAttribute ( System customBuilder ) : void
customBuilder System
return void
        public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
        public void SetParent(System.Type parent) { }

Same methods

TypeBuilder::SetCustomAttribute ( System con, byte binaryAttribute ) : void

Usage Example

Example #1
0
        /// <summary>
        /// Sets a custom attribute using a custom attribute type.
        /// </summary>
        /// <param name="attributeType">Attribute type.</param>
        public void SetCustomAttribute(Type attributeType)
        {
            if (attributeType == null)
            {
                throw new ArgumentNullException("attributeType");
            }

            ConstructorInfo        ci        = attributeType.GetConstructor(Type.EmptyTypes);
            CustomAttributeBuilder caBuilder = new CustomAttributeBuilder(ci, new object[0]);

            _typeBuilder.SetCustomAttribute(caBuilder);
        }
All Usage Examples Of System.Reflection.Emit.TypeBuilder::SetCustomAttribute