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

AppDomain.SetData メソッド (String, Object)

指定したアプリケーション ドメイン プロパティに、指定した値を割り当てます

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

例外例外
解説解説

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

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

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

使用例使用例
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.SetData メソッド (String, Object, IPermission)

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

アプリケーション ドメイン特定のプロパティ対し指定された値を代入ます。プロパティ取得時に呼び出し元に要求するアクセス許可引数として受け取ります

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

例外例外
例外種類条件

ArgumentNullException

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

InvalidOperationException

nameシステム定義のプロパティ文字列指定されているにもかかわらずpermissionnull 参照 (Visual Basic では Nothing) です。

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

AppDomain.SetData メソッド


_AppDomain.SetData メソッド




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

辞書ショートカット

すべての辞書の索引

「AppDomain.SetData」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS