TypeBuilder::SetCustomAttribute Method (CustomAttributeBuilder^)

 

Set a custom attribute using a custom attribute builder.

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public:
void SetCustomAttribute(
	CustomAttributeBuilder^ customBuilder
)

Parameters

customBuilder
Type: System.Reflection.Emit::CustomAttributeBuilder^

An instance of a helper class to define the custom attribute.

Exception Condition
ArgumentNullException

customBuilder is null.

InvalidOperationException

For the current dynamic type, the IsGenericType property is true, but the IsGenericTypeDefinition property is false.

System_CAPS_noteNote

Starting with the .NET Framework 2.0 Service Pack 1, this member no longer requires ReflectionPermission with the ReflectionPermissionFlag::ReflectionEmit flag. (See Security Issues in Reflection Emit.) To use this functionality, your application should target the .NET Framework 3.5 or later.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show: