Export (0) Print
Expand All

EnumBuilder::AssemblyQualifiedName Property

Returns the full path of this enum qualified by the display name of the parent assembly.

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

public:
virtual property String^ AssemblyQualifiedName {
	String^ get () override;
}

Property Value

Type: System::String
Read-only. The full path of this enum qualified by the display name of the parent assembly.

Implements

_Type::AssemblyQualifiedName

ExceptionCondition
NotSupportedException

If CreateType has not been called previously.

The format of the returned string is:

<FullTypeName>, <AssemblyDisplayName>

See AssemblyName for a description of the format of the display name of an assembly.

Version Information

In the .NET Framework version 1.1 and earlier, the return value of this property did not include the culture or public key.

The following code sample demonstrates the use of the AssemblyQualifiedName property to reference the qualified parent assembly name of the current EnumBuilder.

using namespace System;
using namespace System::Collections;
using namespace System::Threading;
using namespace System::Reflection;
using namespace System::Reflection::Emit;

public ref class MyEnumBuilderSample
{
private:
   static AssemblyBuilder^ myAssemblyBuilder;
   static ModuleBuilder^ myModuleBuilder;
   static EnumBuilder^ myEnumBuilder;

public:
   static void Main()
   {
      try
      {
         CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::Save );
         array<Type^>^myTypeArray = myModuleBuilder->GetTypes();
         IEnumerator^ myEnum = myTypeArray->GetEnumerator();
         while ( myEnum->MoveNext() )
         {
            Type^ myType = safe_cast<Type^>(myEnum->Current);
            Console::WriteLine( "Enum Builder defined in the module builder is: {0}", myType->Name );
         }
         Console::WriteLine( "Properties of EnumBuilder : " );
         Console::WriteLine( "Enum Assembly is :{0}", myEnumBuilder->Assembly );
         Console::WriteLine( "Enum AssemblyQualifiedName is :{0}", myEnumBuilder->AssemblyQualifiedName );
         Console::WriteLine( "Enum Module is :{0}", myEnumBuilder->Module );
         Console::WriteLine( "Enum Name is :{0}", myEnumBuilder->Name );
         Console::WriteLine( "Enum NameSpace is :{0}", myEnumBuilder->Namespace );
         myAssemblyBuilder->Save( "EmittedAssembly.dll" );
      }
      catch ( NotSupportedException^ ex ) 
      {
         Console::WriteLine( "The following is the exception is raised: {0}", ex->Message );
      }
      catch ( Exception^ e ) 
      {
         Console::WriteLine( "The following is the exception raised: {0}", e->Message );
      }
   }

private:
   static void CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess /*access*/ )
   {
      // Create a name for the assembly.
      AssemblyName^ myAssemblyName = gcnew AssemblyName;
      myAssemblyName->Name = "EmittedAssembly";

      // Create the dynamic assembly.
      myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save );

      // Create a dynamic module.
      myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" );

      // Create a dynamic Enum.
      myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid );
      FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 );
      FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 );
      myEnumBuilder->CreateType();
   }
};

int main()
{
   MyEnumBuilderSample::Main();
}

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft