Assembly.GetCallingAssembly メソッド
現在実行中のメソッドを呼び出したメソッドの Assembly を返します。
Public Shared Function GetCallingAssembly() As Assembly
[C#]
public static Assembly GetCallingAssembly();
[C++]
public: static Assembly* GetCallingAssembly();
[JScript]
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
[C#]
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);
[C++]
Assembly* SampleAssembly;
// Instantiate a target object.
Int32 Integer1(0);
Type* Type1;
// Set the Type instance to the target class type.
Type1 = __box(Integer1)->GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.
SampleAssembly = Assembly::GetAssembly(__box(Integer1)->GetType());
// Display the name of the assembly that is calling the method.
Console::WriteLine(S"GetCallingAssembly= {0}", Assembly::GetCallingAssembly()->FullName);
[JScript]
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 NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
.NET Framework セキュリティ:
- ReflectionPermission (Type.InvokeMember などの機構を通じて遅延バインディングで呼び出すときに必要なアクセス許可) ReflectionPermissionFlag.MemberAccess (関連する列挙体)