AppDomain.GetDataとは? わかりやすく解説

AppDomain.GetData メソッド

現在のアプリケーション ドメイン内に格納されている、指定した名前の値を取得します

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

例外例外
例外種類条件

ArgumentNullException

namenull 参照 (Visual Basic では Nothing) です。

AppDomainUnloadedException

操作が、アンロードされたアプリケーション ドメイン試行されています。

解説解説

このメソッド使用すると、AppDomain のこのインスタンスプロパティ記述している名前とデータ組み合わせ内部キャッシュ内のエントリの値を取得できます

キャッシュには、アプリケーション ドメイン作成時に挿入される定義済みシステム エントリが自動的に格納されます。この値は、GetData メソッドまたは同等の AppDomainSetup のプロパティ使用して検査できます

独自のユーザー定義の名前とデータ組み合わせ挿入または編集するには、SetData メソッド使用し、その値を検査するには、GetData メソッド使用します

定義済みの各システム エントリの name とそれに対応する AppDomainSetup プロパティの一覧を次の表に示します

name の値

プロパティ

"APPBASE"

ApplicationBase

"LOADER_OPTIMIZATION"

LoaderOptimization

"APP_CONFIG_FILE"

ConfigurationFile

"DYNAMIC_BASE"

DynamicBase

"DEV_PATH"

(プロパティなし)

"APP_NAME"

ApplicationName

"PRIVATE_BINPATH"

PrivateBinPath

"BINPATH_PROBE_ONLY"

PrivateBinPathProbe

"SHADOW_COPY_DIRS"

ShadowCopyDirectories

"FORCE_CACHE_INSTALL"

ShadowCopyFiles

"CACHE_BASE"

CachePath

(アプリケーション固有)

LicenseFile

使用例使用例
Imports System
Imports System.Reflection



Class ADGetData
   
   
   Public Shared Sub Main()
      ' appdomain setup information
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      
      'set predefined system variable application name
      Dim dataName As [String] = "APP_NAME"
      Dim setappname As [String] = "MyApplication"
      currentDomain.SetData(dataName, setappname)
      
      'Create a new value pair for the appdomain
      Dim dataValue As [String] = "ADVALUE"
      Dim advalue As Int32 = 6
      currentDomain.SetData(dataValue, advalue)
      
      'get the value specified in the setdata method
      Console.WriteLine((" ADVALUE is: " + currentDomain.GetData("ADVALUE")))
      
      'get system value specified at appdomainsetup
      Console.WriteLine(("System value for application name:"
 + currentDomain.GetData("APP_NAME")))
   End Sub 'Main 
End Class 'ADGetData
using System;
using System.Reflection;

class ADGetData 
{

    public static void Main()
 
    {
        // appdomain setup information
        AppDomain currentDomain = AppDomain.CurrentDomain;

        //set predefined system variable application name
        String dataName = "APP_NAME";
        String setappname = "MyApplication";
        currentDomain.SetData(dataName, setappname);

        //Create a new value pair for the appdomain
        String dataValue = "ADVALUE";
        Int32 advalue = 6;
        currentDomain.SetData(dataValue, advalue);

        //get the value specified in the setdata method
        Console.WriteLine(" ADVALUE is: " + currentDomain.GetData("ADVALUE"));

        //get system value specified at appdomainsetup
        Console.WriteLine("System value for application name:"
 + currentDomain.GetData("APP_NAME"));
        
    }
   
    
}
using namespace System;
using namespace System::Reflection;
int main()
{
   
   // appdomain setup information
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   
   //set predefined system variable application name
   String^ dataName = "APP_NAME";
   String^ setappname = "MyApplication";
   currentDomain->SetData( dataName, setappname );
   
   //Create a new value pair for the appdomain
   String^ dataValue = "ADVALUE";
   Int32 advalue = 6;
   currentDomain->SetData( dataValue, advalue );
   
   //get the value specified in the setdata method
   Console::WriteLine( " ADVALUE is: {0}", currentDomain->GetData( "ADVALUE"
 ) );
   
   //get system value specified at appdomainsetup
   Console::WriteLine( "System value for application name:
 {0}", currentDomain->GetData( "APP_NAME" ) );
}

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

_AppDomain.GetData メソッド




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

辞書ショートカット

すべての辞書の索引

「AppDomain.GetData」の関連用語

AppDomain.GetDataのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS