MethodBuilder.SetCustomAttribute Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Sets a custom attribute using a custom attribute builder.
Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<SecuritySafeCriticalAttribute> _
Public Sub SetCustomAttribute ( _
customBuilder As CustomAttributeBuilder _
)
[SecuritySafeCriticalAttribute]
public void SetCustomAttribute(
CustomAttributeBuilder customBuilder
)
Parameters
- customBuilder
Type: System.Reflection.Emit.CustomAttributeBuilder
An instance of a helper class to describe the custom attribute.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | customBuilder is nulla null reference (Nothing in Visual Basic). |
InvalidOperationException | For the current method, the IsGenericMethod property is true, but the IsGenericMethodDefinition property is false. |
Remarks
The SetCustomAttribute method can interact with the SetImplementationFlags method when the two methods are used in combination. See the Remarks section of the SetImplementationFlags method for details.
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.