AppDomain.ReflectionOnlyGetAssemblies メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim instance As AppDomain Dim returnValue As Assembly() returnValue = instance.ReflectionOnlyGetAssemblies
アプリケーション ドメインのリフレクション専用コンテキストに読み込まれているアセンブリを表す Assembly オブジェクトの配列。



System.dll アセンブリを実行コンテキストおよびリフレクション専用コンテキストの順に読み込むコード例を次に示します。GetAssemblies メソッドおよび ReflectionOnlyGetAssemblies メソッドを使用して、各コンテキストに読み込まれたアセンブリを表示しています。
Imports System Imports System.Reflection Imports System.Timers Public Class Example Public Shared Sub Main() ' Get the assembly display name for System.dll, the assembly ' that contains System.Timers.Timer. Note that this causes ' System.dll to be loaded into the execution context. ' Dim displayName As String = GetType(Timer).Assembly.FullName ' Load System.dll into the reflection-only context. Note that ' if you obtain the display name (for example, by running this ' example program), and enter it as a literal string in the ' preceding line of code, you can load System.dll into the ' reflection-only context without loading it into the execution ' context. Assembly.ReflectionOnlyLoad(displayName) ' Display the assemblies loaded into the execution and ' reflection-only contexts. System.dll appears in both contexts. ' Dim ad As AppDomain = AppDomain.CurrentDomain Console.WriteLine("------------- Execution Context --------------") For Each a As Assembly In ad.GetAssemblies() Console.WriteLine(vbTab + "{0}", a.GetName()) Next a Console.WriteLine("------------- Reflection-only Context --------------") For Each a As Assembly In ad.ReflectionOnlyGetAssemblies() Console.WriteLine(vbTab + "{0}", a.GetName()) Next a End Sub End Class
using System; using System.Reflection; using System.Timers; public class Example { public static void Main() { // Get the assembly display name for System.dll, the assembly // that contains System.Timers.Timer. Note that this causes // System.dll to be loaded into the execution context. // string displayName = typeof(Timer).Assembly.FullName; // Load System.dll into the reflection-only context. Note that // if you obtain the display name (for example, by running this // example program), and enter it as a literal string in the // preceding line of code, you can load System.dll into the // reflection-only context without loading it into the execution // context. Assembly.ReflectionOnlyLoad(displayName); // Display the assemblies loaded into the execution and // reflection-only contexts. System.dll appears in both contexts. // Console.WriteLine("------------- Execution Context --------------"); foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { Console.WriteLine("\t{0}", a.GetName()); } Console.WriteLine("------------- Reflection-only Context --------------"); foreach (Assembly a in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()) { Console.WriteLine("\t{0}", a.GetName()); } } }
using namespace System; using namespace System::Reflection; #using <System.dll> using namespace System::Timers; using namespace System::Collections; int main() { // Get the assembly display name for System.dll, the assembly // that contains System.Timers.Timer. Note that this causes // System.dll to be loaded into the execution context. // String^ displayName = Timer::typeid->Assembly->FullName; // Load System.dll into the reflection-only context. Note that // if you obtain the display name (for example, by running this // example program), and enter it as a literal string in the // preceding line of code, you can load System.dll into the // reflection-only context without loading it into the execution // context. Assembly::ReflectionOnlyLoad( displayName ); // Display the assemblies loaded into the execution and // reflection-only contexts. System.dll appears in both contexts. // Console::WriteLine( L"------------- Execution Context --------------" ); IEnumerator^ myEnum = AppDomain::CurrentDomain->GetAssemblies()->GetEnumerator(); while ( myEnum->MoveNext() ) { Assembly^ a = safe_cast<Assembly^>(myEnum->Current); Console::WriteLine( L"\t{0}", a->GetName() ); } Console::WriteLine( L"------------- Reflection-only Context --------------" ); IEnumerator^ myEnum1 = AppDomain::CurrentDomain->ReflectionOnlyGetAssemblies()->GetEnumerator(); while ( myEnum1->MoveNext() ) { Assembly^ a = safe_cast<Assembly^>(myEnum1->Current); Console::WriteLine( L"\t{0}", a->GetName() ); } }
import System.*; import System.Reflection.*; import System.Timers.*; public class Example { public static void main(String[] args) { // Get the assembly display name for System.dll, the assembly // that contains System.Timers.Timer. Note that this causes // System.dll to be loaded into the execution context. // String displayName = Timer.class.ToType().get_Assembly().get_FullName(); // Load System.dll into the reflection-only context. Note that // if you obtain the display name (for example, by running this // example program), and enter it as a literal string in the // preceding line of code, you can load System.dll into the // reflection-only context without loading it into the execution // context. Assembly.ReflectionOnlyLoad(displayName); // Display the assemblies loaded into the execution and // reflection-only contexts. System.dll appears in both contexts. // Console.WriteLine("------------- Execution Context --------------"); Assembly a = null; for (int iCtr = 0; iCtr < AppDomain.get_CurrentDomain(). GetAssemblies().get_Length(); iCtr++) { a = AppDomain.get_CurrentDomain().GetAssemblies()[iCtr]; Console.WriteLine("\t{0}", a.GetName()); } Console.WriteLine("------------- Reflection-only Context --------------"); for (int iCtr = 0; iCtr < AppDomain.get_CurrentDomain(). ReflectionOnlyGetAssemblies().get_Length(); iCtr++) { a = AppDomain.get_CurrentDomain(). ReflectionOnlyGetAssemblies()[iCtr]; Console.WriteLine("\t{0}", a.GetName()); } } //main } //Example

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- AppDomain.ReflectionOnlyGetAssemblies メソッドのページへのリンク