AppDomainSetup.AppDomainInitializerArguments プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AppDomainSetup.AppDomainInitializerArguments プロパティの意味・解説 

AppDomainSetup.AppDomainInitializerArguments プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

AppDomainInitializer デリゲートが表すコールバック メソッドへの引数取得または設定しますコールバック メソッドは、アプリケーション ドメイン初期化時に呼び出されます。

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

Public Property AppDomainInitializerArguments
 As String()
Dim instance As AppDomainSetup
Dim value As String()

value = instance.AppDomainInitializerArguments

instance.AppDomainInitializerArguments = value
public string[] AppDomainInitializerArguments
 { get; set; }
public:
property array<String^>^ AppDomainInitializerArguments {
    array<String^>^ get ();
    void set (array<String^>^ value);
}
/** @property */
public String[] get_AppDomainInitializerArguments ()

/** @property */
public void set_AppDomainInitializerArguments
 (String[] value)
public function get AppDomainInitializerArguments
 () : String[]

public function set AppDomainInitializerArguments
 (value : String[])

プロパティ
AppDomain初期化中、AppDomainInitializer デリゲートが表すコールバック メソッド呼び出されたとき、このコールバック メソッド渡される文字列配列

解説解説
使用例使用例

次のコード例では、AppDomainSetup オブジェクトと、既定アプリケーション ドメインから取得した証拠使用しChildDomain という子のアプリケーション ドメイン作成してます。AppDomainInitializer プロパティコールバック メソッド AppDomainInit設定し、子のドメイン初期化されたときに呼び出されるようにしています。コールバック メソッド引数は、文字列配列として格納し、この配列AppDomainInitializerArguments プロパティ代入ます。子のドメイン作成されると、コールバック メソッドによって、これらの文字列出力されます。

Imports System
Imports System.Security.Policy

Public Class Example

    Public Shared Sub Main()

        ' Get a reference to the default application domain.
        '
        Dim current As AppDomain = AppDomain.CurrentDomain

        ' Create the AppDomainSetup that will be used to set up the
 child
        ' AppDomain.
        Dim ads As New AppDomainSetup()

        ' Use the evidence from the default application domain to
        ' create evidence for the child application domain.
        '
        Dim ev As Evidence = New
 Evidence(current.Evidence)

        ' Create an AppDomainInitializer delegate that represents the
 
        ' callback method, AppDomainInit. Assign this delegate to the
        ' AppDomainInitializer property of the AppDomainSetup object.
        '
        Dim adi As New AppDomainInitializer(AddressOf
 AppDomainInit)
        ads.AppDomainInitializer = adi

        ' Create an array of strings to pass as arguments to the callback
        ' method. Assign the array to the AppDomainInitializerArguments
        ' property.
        Dim initArgs() As String
 = {"String1", "String2"}
        ads.AppDomainInitializerArguments = initArgs

        ' Create a child application domain named "ChildDomain",
 using 
        ' the evidence and the AppDomainSetup object.
        '
        Dim ad As AppDomain = _
            AppDomain.CreateDomain("ChildDomain",
 ev, ads)

        Console.WriteLine("Press the Enter key to exit the example
 program.")
        Console.ReadLine()
    End Sub

    ' The callback method invoked when the child application domain
 is
    ' initialized. The method simply displays the arguments that were
    ' passed to it.
    '
    Public Shared Sub AppDomainInit(ByVal
 args() As String)
        Console.WriteLine("AppDomain ""{0}""
 is initialized with these arguments:", _
            AppDomain.CurrentDomain.FriendlyName)
        For Each arg As
 String In args
            Console.WriteLine("    {0}", arg)
        Next
    End Sub
End Class

' This code example produces the following output:
'
'AppDomain "ChildDomain" is initialized with these arguments:
'    String1
'    String2
using System;
using System.Security.Policy;

public class Example
{
    public static void Main()
    {
        // Get a reference to the default application domain.
        //
        AppDomain current = AppDomain.CurrentDomain;

        // Create the AppDomainSetup that will be used to set up the
 child
        // AppDomain.
        AppDomainSetup ads = new AppDomainSetup();

        // Use the evidence from the default application domain to
        // create evidence for the child application domain.
        //
        Evidence ev = new Evidence(current.Evidence);

        // Create an AppDomainInitializer delegate that represents the
 
        // callback method, AppDomainInit. Assign this delegate to the
        // AppDomainInitializer property of the AppDomainSetup object.
        //
        AppDomainInitializer adi = new AppDomainInitializer(AppDomainInit);
        ads.AppDomainInitializer = adi;

        // Create an array of strings to pass as arguments to the callback
        // method. Assign the array to the AppDomainInitializerArguments
        // property.
        string[] initArgs = {"String1", "String2"};
        ads.AppDomainInitializerArguments = initArgs;

        // Create a child application domain named "ChildDomain",
 using 
        // the evidence and the AppDomainSetup object.
        //
        AppDomain ad = AppDomain.CreateDomain("ChildDomain", ev, ads);

        Console.WriteLine("Press the Enter key to exit the example program.");
        Console.ReadLine();
    }

    // The callback method invoked when the child application domain
 is
    // initialized. The method simply displays the arguments that were
    // passed to it.
    //
    public static void AppDomainInit(string[]
 args)
    {
        Console.WriteLine("AppDomain \"{0}\" is initialized with these
 arguments:", 
            AppDomain.CurrentDomain.FriendlyName);
        foreach (string arg in
 args)
        {
            Console.WriteLine("    {0}", arg);
        }
    }
}

/* This code example produces the following output:

AppDomain "ChildDomain" is initialized with these arguments:
    String1
    String2
 */
using namespace System;
using namespace System::Security::Policy;

public ref class AppDomainInitializerExample
{
    // The callback method invoked when the child application domain
 is
    // initialized. The method simply displays the arguments that were
    // passed to it.
    //
public:
    static void AppDomainInit(array<String^>^
 args)
    {
        Console::WriteLine("AppDomain \"{0}\" is initialized with
 these " +
            "arguments:", AppDomain::CurrentDomain->FriendlyName);
        for each (String^ arg in args)
        {
            Console::WriteLine("    {0}", arg);
        }
    }
};

int main()
{
    // Get a reference to the default application domain.
    //
    AppDomain^ currentDomain = AppDomain::CurrentDomain;
    
    // Create the AppDomainSetup that will be used to set up the child
    // AppDomain.
    AppDomainSetup^ domainSetup = gcnew AppDomainSetup();

    // Use the evidence from the default application domain to
    // create evidence for the child application domain.
    //
    Evidence^ evidence = gcnew Evidence(currentDomain->Evidence);

    // Create an AppDomainInitializer delegate that represents the
    // callback method, AppDomainInit. Assign this delegate to the
    // AppDomainInitializer property of the AppDomainSetup object.
    //
    AppDomainInitializer^ domainInitializer =
        gcnew AppDomainInitializer(AppDomainInitializerExample::AppDomainInit);
    domainSetup->AppDomainInitializer = domainInitializer;

    // Create an array of strings to pass as arguments to the callback
    // method. Assign the array to the AppDomainInitializerArguments
    // property.
    array<String^>^ initialArguments = {"String1", "String2"};
    domainSetup->AppDomainInitializerArguments = initialArguments;

    // Create a child application domain named "ChildDomain",
 using
    // the evidence and the AppDomainSetup object.
    //
    AppDomain^ appDomain = AppDomain::CreateDomain("ChildDomain",
        evidence, domainSetup);

    Console::WriteLine("Press the Enter key to exit the example program.");
    Console::ReadLine();
}

/* This code example produces the following output:

AppDomain "ChildDomain" is initialized with these arguments:
String1
String2
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AppDomainSetup クラス
AppDomainSetup メンバ
System 名前空間
AppDomainInitializer デリゲート
AppDomainSetup.AppDomainInitializer プロパティ



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

辞書ショートカット

すべての辞書の索引

AppDomainSetup.AppDomainInitializerArguments プロパティのお隣キーワード
検索ランキング

   

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



AppDomainSetup.AppDomainInitializerArguments プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS