다음을 통해 공유


AppDomain.GetAssemblies 메서드

이 응용 프로그램 도메인의 실행 컨텍스트에 로드된 어셈블리를 가져옵니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public Function GetAssemblies As Assembly()
‘사용 방법
Dim instance As AppDomain
Dim returnValue As Assembly()

returnValue = instance.GetAssemblies
public Assembly[] GetAssemblies ()
public:
virtual array<Assembly^>^ GetAssemblies () sealed
public final Assembly[] GetAssemblies ()
public final function GetAssemblies () : Assembly[]

반환 값

이 응용 프로그램 도메인에 있는 어셈블리의 배열입니다.

예외

예외 형식 조건

AppDomainUnloadedException

언로드된 응용 프로그램 도메인에서 작업을 시도한 경우

예제

Imports System
Imports System.Reflection
Imports System.Security.Policy 'for Evidence object

Class ADGetAssemblies
   
   
   Public Shared Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      'Provide the current application domain evidence for the assembly.
      Dim asEvidence As Evidence = currentDomain.Evidence
      'Load the assembly from the application directory using a simple name.
     
      'Create an assembly called CustomLibrary to run this sample.
      currentDomain.Load("CustomLibrary", asEvidence)
      
      'Make an array for the list of assemblies.
      Dim assems As [Assembly]() = currentDomain.GetAssemblies()
      
      'List the assemblies in the current application domain.
      Console.WriteLine("List of assemblies loaded in current appdomain:")
      Dim assem As [Assembly]
      For Each assem In  assems
         Console.WriteLine(assem.ToString())
      Next assem
   End Sub 'Main 
End Class 'ADGetAssemblies 
using System;
using System.Reflection;
using System.Security.Policy;  //for Evidence object

class ADGetAssemblies 
{

    public static void Main() 
    {
        AppDomain currentDomain = AppDomain.CurrentDomain;
        //Provide the current application domain evidence for the assembly.
        Evidence asEvidence = currentDomain.Evidence;
        //Load the assembly from the application directory using a simple name.

        //Create an assembly called CustomLibrary to run this sample.
        currentDomain.Load("CustomLibrary",asEvidence);

        //Make an array for the list of assemblies.
        Assembly[] assems = currentDomain.GetAssemblies();
    
        //List the assemblies in the current application domain.
        Console.WriteLine("List of assemblies loaded in current appdomain:");
            foreach (Assembly assem in assems)
                Console.WriteLine(assem.ToString());
    }
   
}
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy;

//for Evidence Object
int main()
{
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   
   //Provide the current application domain evidence for the assembly.
   Evidence^ asEvidence = currentDomain->Evidence;
   
   //Load the assembly from the application directory using a simple name.
   //Create an assembly called CustomLibrary to run this sample.
   currentDomain->Load( "CustomLibrary", asEvidence );
   
   //Make an array for the list of assemblies.
   array<Assembly^>^assems = currentDomain->GetAssemblies();
   
   //List the assemblies in the current application domain.
   Console::WriteLine( "List of assemblies loaded in current appdomain:" );
   System::Collections::IEnumerator^ myEnum = assems->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Assembly^ assem = safe_cast<Assembly^>(myEnum->Current);
      Console::WriteLine( assem );
   }
}

플랫폼

Windows 98, Windows 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

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

AppDomain 클래스
AppDomain 멤버
System 네임스페이스