EnumBuilder.AssemblyQualifiedName Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Public Overrides ReadOnly Property AssemblyQualifiedName As String
public override string AssemblyQualifiedName { get; }

Property Value

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

Exceptions

Exception Condition
NotSupportedException

If CreateType has not been called previously.

Remarks

The format of the returned string is:

<FullTypeName>, <AssemblyDisplayName>

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

Examples

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

Imports System.Reflection
Imports System.Reflection.Emit

Class Example

   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

      ' Get the current application domain.
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain

      ' Create a dynamic assembly in the current application domain, 
      ' and allow it to be executed.
      Dim aName As AssemblyName = New AssemblyName("TempAssembly")
      Dim ab As AssemblyBuilder = currentDomain.DefineDynamicAssembly( _
          aName, AssemblyBuilderAccess.Run)

      ' Define a dynamic module in "TempAssembly" assembly. The module can
      ' have the same name as the assembly.
      Dim mb As ModuleBuilder = _
          ab.DefineDynamicModule(aName.Name)

      ' Define a public enumeration with the name "Elevation" and an 
      ' underlying type of Integer.
      Dim eb As EnumBuilder = _
          mb.DefineEnum("Elevation", TypeAttributes.Public, GetType(Integer))

      ' Define two members, "High" and "Low".
      eb.DefineLiteral("Low", 0)
      eb.DefineLiteral("High", 1)

      ' Create the type.
      Dim finished As Type = eb.CreateType()

      For Each fi As FieldInfo in finished.GetFields()
         outputBlock.Text += String.Format("{0}.{1} = {2}" & vbCrLf, _
            finished.Name, fi.Name, fi.GetRawConstantValue())
      Next

      outputBlock.Text &= "Properties of EnumBuilder:  " & vbCrLf
      outputBlock.Text &= "Assembly: " & eb.Assembly.ToString() & vbCrLf
      outputBlock.Text &= "AssemblyQualifiedName: " & eb.AssemblyQualifiedName.ToString() & vbCrLf
      outputBlock.Text &= "Module: " & eb.Module.ToString() & vbCrLf
      outputBlock.Text &= "Name: " & eb.Name.ToString() & vbCrLf
      outputBlock.Text &= "NameSpace: " & eb.Namespace & vbCrLf
   End Sub
End Class

' This code example produces output similar to the following:
'
'Elevation.Low = 0
'Elevation.High = 1 
'Properties of EnumBuilder: 
'Assembly: TempAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
'AssemblyQualifiedName: Elevation, TempAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
'Module: RefEmit_InMemoryManifestModule
'Name: Elevation
'NameSpace: 
using System;
using System.Reflection;
using System.Reflection.Emit;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Get the current application domain.
      AppDomain currentDomain = AppDomain.CurrentDomain;

      // Create a dynamic assembly in the current application domain, 
      // and allow it to be executed.
      AssemblyName aName = new AssemblyName("TempAssembly");
      AssemblyBuilder ab = currentDomain.DefineDynamicAssembly(aName, 
         AssemblyBuilderAccess.Run);

      // Define a dynamic module in "TempAssembly" assembly. The module can
      // have the same name as the assembly.
      ModuleBuilder mb = ab.DefineDynamicModule(aName.Name);

      // Define a public enumeration with the name "Elevation" and an 
      // underlying type of Integer.
      EnumBuilder eb = mb.DefineEnum("Elevation", 
         TypeAttributes.Public, typeof(int));

      // Define two members, "High" and "Low".
      eb.DefineLiteral("Low", 0);
      eb.DefineLiteral("High", 1);

      // Create the type.
      Type finished = eb.CreateType();

      foreach( FieldInfo fi in finished.GetFields() )
      {
         outputBlock.Text += String.Format("{0}.{1} = {2}\n", 
            finished.Name, fi.Name, fi.GetRawConstantValue());
      }

      outputBlock.Text += "Properties of EnumBuilder:  " + "\n";
      outputBlock.Text += "Assembly: " + eb.Assembly.ToString() + "\n";
      outputBlock.Text += "AssemblyQualifiedName: " + eb.AssemblyQualifiedName.ToString() + "\n";
      outputBlock.Text += "Module: " + eb.Module.ToString() + "\n";
      outputBlock.Text += "Name: " + eb.Name.ToString() + "\n";
      outputBlock.Text += "NameSpace: " + eb.Namespace + "\n";
   }
}

/* This code example produces output similar to the following:

Elevation.Low = 0
Elevation.High = 1 
Properties of EnumBuilder: 
Assembly: TempAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
AssemblyQualifiedName: Elevation, TempAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Module: RefEmit_InMemoryManifestModule
Name: Elevation
NameSpace: 
 */

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.