다음을 통해 공유


EnumBuilder.AssemblyQualifiedName 속성

정의

부모 어셈블리의 표시 이름으로 정규화된 이 열거형의 전체 경로를 반환합니다.

public:
 virtual property System::String ^ AssemblyQualifiedName { System::String ^ get(); };
public override string? AssemblyQualifiedName { get; }
public override string AssemblyQualifiedName { get; }
member this.AssemblyQualifiedName : string
Public Overrides ReadOnly Property AssemblyQualifiedName As String

속성 값

읽기 전용입니다. 부모 어셈블리의 표시 이름으로 정규화된 이 열거형의 전체 경로입니다.

예제

다음 코드 샘플에서는 현재 EnumBuilderAssemblyQualifiedName 정규화된 부모 어셈블리 이름을 참조하기 위해 속성을 사용하는 방법을 보여 줍니다.

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();
}
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();
   }
}
Imports System.Collections
Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit

Public Class MyEnumBuilderSample
   Private Shared myAssemblyBuilder As AssemblyBuilder
   Private Shared myModuleBuilder As ModuleBuilder
   Private Shared myEnumBuilder As EnumBuilder
   
   Public Shared Sub Main()
      Try
         CreateCallee(Thread.GetDomain(), AssemblyBuilderAccess.Save)
         Dim myTypeArray As Type() = myModuleBuilder.GetTypes()
         Dim myType As Type
         For Each myType In  myTypeArray
            Console.WriteLine("Enum Builder defined in the module builder is: " + myType.Name)
         Next myType
         
         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 ex As NotSupportedException
         Console.WriteLine("The following is the exception is raised: " + ex.Message)
      Catch e As Exception
         Console.WriteLine("The following is the exception raised: " + e.Message)
      End Try
   End Sub
   
   Private Shared Sub CreateCallee(myAppDomain As AppDomain, access As AssemblyBuilderAccess)
      ' Create a name for the assembly.
      Dim myAssemblyName As 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, GetType(Int32))
      
      Dim myFieldBuilder1 As FieldBuilder = myEnumBuilder.DefineLiteral("FieldOne", 1)
      Dim myFieldBuilder2 As FieldBuilder = myEnumBuilder.DefineLiteral("FieldTwo", 2)
      
      myEnumBuilder.CreateType()
   End Sub
End Class

설명

반환된 문자열의 형식은 다음과 같습니다.

<FullTypeName>, <AssemblyDisplayName>

어셈블리의 표시 이름 형식에 대한 설명은 을 참조하세요 AssemblyName .

적용 대상