Exemplo n.º 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(System.Type.EmptyTypes);
            var             caBuilder = new RefCustomAttributeBuilder(ci, new object[0]);

            _methodBuilder.SetCustomAttribute(caBuilder);
        }