This documentation is archived and is not being maintained.

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 override string AssemblyQualifiedName { get; }
/** @property */
public String get_AssemblyQualifiedName ()

public override function get AssemblyQualifiedName () : String

Not applicable.

Property Value

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

Exception typeCondition

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 System;
using System.Collections;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;

public class MyEnumBuilderSample
{
   static AssemblyBuilder myAssemblyBuilder;
   static ModuleBuilder myModuleBuilder;
   static EnumBuilder myEnumBuilder;
   
   public static void Main()
   {
      try
      {
         CreateCallee(Thread.GetDomain(), AssemblyBuilderAccess.Save);
         Type[] myTypeArray = myModuleBuilder.GetTypes();
         foreach(Type myType in myTypeArray)
         {
            Console.WriteLine("Enum Builder defined in the module builder is: " 
               + myType.Name);
         }

         Console.WriteLine("Properties of EnumBuilder : ");
         Console.WriteLine("Enum Assembly is :" +  myEnumBuilder.Assembly.ToString());
         Console.WriteLine("Enum AssemblyQualifiedName is :" +  
                                 myEnumBuilder.AssemblyQualifiedName.ToString());
         Console.WriteLine("Enum Module is :" +  myEnumBuilder.Module.ToString());
         Console.WriteLine("Enum Name is :" +  myEnumBuilder.Name.ToString());
         Console.WriteLine("Enum NameSpace is :" +  myEnumBuilder.Namespace);
         myAssemblyBuilder.Save("EmittedAssembly.dll");
      }
      catch(NotSupportedException ex)
      {
         Console.WriteLine("The following is the exception is raised: " + ex.Message);
      }
      catch(Exception e)
      {
         Console.WriteLine("The following is the exception raised: " + e.Message);
      }
   }

   private static void CreateCallee(AppDomain myAppDomain, AssemblyBuilderAccess access)
   {
      // Create a name for the assembly.
      AssemblyName myAssemblyName = new 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, typeof(Int32));

      FieldBuilder myFieldBuilder1 = myEnumBuilder.DefineLiteral("FieldOne", 1);
      FieldBuilder myFieldBuilder2 = myEnumBuilder.DefineLiteral("FieldTwo", 2);

      myEnumBuilder.CreateType();
   }
}

import System.*;
import System.Collections.*;
import System.Threading.*;
import System.Reflection.*;
import System.Reflection.Emit.*;

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

    public static void main(String[] args)
    {
        try {
            CreateCallee(System.Threading.Thread.GetDomain(), 
                AssemblyBuilderAccess.Save);
            Type myTypeArray[] = myModuleBuilder.GetTypes();
            Type myType = null;
            for (int iCtr = 0; iCtr < myTypeArray.length; iCtr++ ) {
                myType = myTypeArray[iCtr];
                Console.WriteLine("Enum Builder defined in the module "
                    + "builder is: " + myType.get_Name());
            }
            Console.WriteLine("Properties of EnumBuilder : ");
            Console.WriteLine("Enum Assembly is :" 
                + myEnumBuilder.get_Assembly().ToString());
            Console.WriteLine("Enum AssemblyQualifiedName is :" 
                + myEnumBuilder.get_AssemblyQualifiedName().ToString());
            Console.WriteLine("Enum Module is :" 
                + myEnumBuilder.get_Module().ToString());
            Console.WriteLine("Enum Name is :" 
                + myEnumBuilder.get_Name().ToString());
            Console.WriteLine("Enum NameSpace is :" 
                + myEnumBuilder.get_Namespace());
            myAssemblyBuilder.Save("EmittedAssembly.dll");
        }
        catch (NotSupportedException ex) {
            Console.WriteLine("The following is the exception is raised: "
                + ex.get_Message());
        }
        catch (System.Exception e) {
            Console.WriteLine("The following is the exception raised: " 
                + e.get_Message());
        }
    } //main

    private static void CreateCallee(AppDomain myAppDomain,
        AssemblyBuilderAccess access)
    {
        // Create a name for the assembly.
        AssemblyName myAssemblyName = new AssemblyName();
        myAssemblyName.set_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.class.ToType());

        FieldBuilder myFieldBuilder1 = myEnumBuilder.DefineLiteral("FieldOne",
            (Int32)1);
        FieldBuilder myFieldBuilder2 = myEnumBuilder.DefineLiteral("FieldTwo", 
            (Int32)2);
        myEnumBuilder.CreateType();
    } //CreateCallee
} //MyEnumBuilderSample

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: