다음을 통해 공유


Assembly.GetCallingAssembly 메서드

현재 실행 중인 메서드를 호출하는 메서드의 Assembly를 반환합니다.

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

구문

‘선언
Public Shared Function GetCallingAssembly As Assembly
‘사용 방법
Dim returnValue As Assembly

returnValue = Assembly.GetCallingAssembly
public static Assembly GetCallingAssembly ()
public:
static Assembly^ GetCallingAssembly ()
public static Assembly GetCallingAssembly ()
public static function GetCallingAssembly () : Assembly

반환 값

현재 실행 중인 메서드를 호출하는 메서드의 Assembly 개체입니다.

예제

다음 예제에서는 현재 메서드의 호출 어셈블리를 가져옵니다.

    Dim SampleAssembly As [Assembly]
    ' Instantiate a target object.
    Dim Integer1 As New Int32()
    Dim Type1 As Type
    ' Set the Type instance to the target class type.
    Type1 = Integer1.GetType()
    ' Instantiate an Assembly class to the assembly housing the Integer type.  
    SampleAssembly = [Assembly].GetAssembly(Integer1.GetType())
    ' Display the name of the assembly that is calling the method.
    Console.WriteLine(("GetCallingAssembly=" + [Assembly].GetCallingAssembly().FullName))
End Sub 'Snippet4
Assembly SampleAssembly;
// Instantiate a target object.
Int32 Integer1 = new Int32();
Type Type1;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.  
SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
// Display the name of the assembly that is calling the method.
Console.WriteLine("GetCallingAssembly=" + Assembly.GetCallingAssembly().FullName);
Assembly^ SampleAssembly;
// Instantiate a target object.
Int32 Integer1(0);
Type^ Type1;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.  
SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
// Display the name of the assembly that is calling the method.
Console::WriteLine( "GetCallingAssembly= {0}", Assembly::GetCallingAssembly()->FullName );
var SampleAssembly : Assembly;
// Instantiate a target object.
var Integer1 : Int32 = 0;
var Type1 : Type;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.  
SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
// Display the name of the assembly that is calling the method.
Console.WriteLine("GetCallingAssembly=" + Assembly.GetCallingAssembly().FullName);

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, 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에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Assembly 클래스
Assembly 멤버
System.Reflection 네임스페이스