The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
ConstructorBuilder::SetSymCustomAttribute Method (String^, array<Byte>^)
.NET Framework (current version)
Sets this constructor's custom attribute associated with symbolic information.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- name
-
Type:
System::String^
The name of the custom attribute.
- data
-
Type:
array<System::Byte>^
The value of the custom attribute.
| Exception | Condition |
|---|---|
| InvalidOperationException | The containing type has been created using CreateType. -or- The module does not have a symbol writer defined. For example, the module is not a debug module. |
The following code sample illustrates the use of SetSymCustomAttributes.
MethodBuilder^ myMethodBuilder = nullptr; AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; // Create assembly in current CurrentDomain. AssemblyName^ myAssemblyName = gcnew AssemblyName; myAssemblyName->Name = "TempAssembly"; // Create a dynamic assembly. myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); // Create a dynamic module in the assembly. myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", true ); FieldInfo^ myFieldInfo = myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); // Create a type in the module. TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public ); array<Type^>^ myConstructorArgs = {String::typeid}; // Define a constructor of the dynamic class. ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); // Display the name of the constructor. Console::WriteLine( "The constructor name is : {0}", myConstructor->Name ); array<Byte>^ temp0 = {01,00,00}; myConstructor->SetSymCustomAttribute( "MySimAttribute", temp0 );
.NET Framework
Available since 1.1
Available since 1.1
Show: