This documentation is archived and is not being maintained.

MethodBuilder.SetSymCustomAttribute Method

Set a symbolic custom attribute using a blob.

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

Public Sub SetSymCustomAttribute ( _
	name As String, _
	data As Byte() _


Type: System.String
The name of the symbolic custom attribute.
Type: System.Byte()
The byte blob that represents the value of the symbolic custom attribute.


The containing type was previously created using CreateType.


The module that contains this method is not a debug module.


For the current method, the IsGenericMethod property is true, but the IsGenericMethodDefinition property is false.

Unlike the metadata custom attribute, this custom attribute is associated with a symbol writer.

The code sample below illustrates the contextual usage of the SetSymCustomAttribute method to set the byte values for the name and key of a custom attribute attached to a method.

      Dim myMethod As MethodBuilder = myDynamicType.DefineMethod("MyMethod", _
					 MethodAttributes.Public, GetType(Integer), _
					 New Type() {GetType(String)})

      ' A 128-bit key in hex form, represented as a byte array.
      Dim keyVal As Byte() =  {&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, _
			       &H0, &H0, &H0, &H0, &H0, &H60, &HFF, &HFF}

      Dim encoder As New System.Text.ASCIIEncoding()
      Dim symFullName As Byte() = encoder.GetBytes("My Dynamic Method")

      myMethod.SetSymCustomAttribute("SymID", keyVal)
      myMethod.SetSymCustomAttribute("SymFullName", symFullName)

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.