AppDomain.ReflectionOnlyGetAssemblies メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AppDomain.ReflectionOnlyGetAssemblies メソッドの意味・解説 

AppDomain.ReflectionOnlyGetAssemblies メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

アプリケーション ドメインリフレクション専用コンテキスト読み込まれているアセンブリ返します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function ReflectionOnlyGetAssemblies
 As Assembly()
Dim instance As AppDomain
Dim returnValue As Assembly()

returnValue = instance.ReflectionOnlyGetAssemblies
public Assembly[] ReflectionOnlyGetAssemblies ()
public:
array<Assembly^>^ ReflectionOnlyGetAssemblies ()
public Assembly[] ReflectionOnlyGetAssemblies ()
public function ReflectionOnlyGetAssemblies
 () : Assembly[]

戻り値
アプリケーション ドメインリフレクション専用コンテキスト読み込まれているアセンブリを表す 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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

AppDomain.ReflectionOnlyGetAssemblies メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AppDomain.ReflectionOnlyGetAssemblies メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS