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

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

_AppDomain.DoCallBack メソッド

COM オブジェクトに、AppDomain.DoCallBack メソッドへのバージョン依存しないアクセス用意されています。

このメソッドは、CLS準拠していません。  

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

Sub DoCallBack ( _
    theDelegate As CrossAppDomainDelegate _
)
Dim instance As _AppDomain
Dim theDelegate As CrossAppDomainDelegate

instance.DoCallBack(theDelegate)
void DoCallBack (
    CrossAppDomainDelegate theDelegate
)
void DoCallBack (
    CrossAppDomainDelegate^ theDelegate
)
void DoCallBack (
    CrossAppDomainDelegate theDelegate
)
function DoCallBack (
    theDelegate : CrossAppDomainDelegate
)

パラメータ

theDelegate
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

AppDomain.DoCallBack メソッド

指定したデリゲート識別される別のアプリケーション ドメイン内のコード実行します

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

Public Sub DoCallBack ( _
    callBackDelegate As CrossAppDomainDelegate _
)
Dim instance As AppDomain
Dim callBackDelegate As CrossAppDomainDelegate

instance.DoCallBack(callBackDelegate)
public void DoCallBack (
    CrossAppDomainDelegate callBackDelegate
)
public:
virtual void DoCallBack (
    CrossAppDomainDelegate^ callBackDelegate
) sealed
public final void DoCallBack (
    CrossAppDomainDelegate callBackDelegate
)
public final function DoCallBack (
    callBackDelegate : CrossAppDomainDelegate
)

パラメータ

callBackDelegate

呼び出すメソッド指定するデリゲート

解説解説

callBackDelegate には、値渡しによるマーシャリング オブジェクト、MarshalByRefObject、または ContextBoundObject を指定できます

使用例使用例

静的DoCallBack メソッド使用方法次のサンプル示します

Public Module PingPong

   Private greetings As String
 = "PONG!"
   
   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      greetings = "PING!"

      MyCallBack()
      otherDomain.DoCallBack(AddressOf MyCallBack)

      ' Output:
      '   PING! from default domain
      '   PONG! from otherDomain
   End Sub 'Main
   
   Sub MyCallBack()
      Dim name As String
 = AppDomain.CurrentDomain.FriendlyName
      Console.WriteLine(greetings + " from " + name)
   End Sub 'MyCallBack

End Module 'PingPong
static string greetings = "PONG!";

public static void Main()
 {
   AppDomain currentDomain = AppDomain.CurrentDomain;
   AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

   greetings = "PING!";

   MyCallBack();
   otherDomain.DoCallBack(new CrossAppDomainDelegate(MyCallBack));

   // Output:
   //   PING! from default domain
   //   PONG! from otherDomain
}

static public void MyCallBack()
 {
   string name = AppDomain.CurrentDomain.FriendlyName;
   Console.WriteLine(greetings + " from " + name);
}
public ref class PingPong
{
private:
   static String^ greetings = "PONG!";

public:
   static void MyCallBack()
   {
      String^ name = AppDomain::CurrentDomain->FriendlyName;
      Console::WriteLine(  "{0} from {1}", greetings, name );
   }

   static void Ping()
   {
      AppDomain^ currentDomain = AppDomain::CurrentDomain;
      AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
      greetings = "PING!";
      MyCallBack();
      otherDomain->DoCallBack( gcnew CrossAppDomainDelegate( MyCallBack ) );
      
      // Output:
      //   PING! from default domain
      //   PONG! from otherDomain
   }

};

int main()
{
   PingPong::Ping();
}

private static String greetings = "PONG!";

public static void main(String[]
 args)
{
    AppDomain currentDomain = AppDomain.get_CurrentDomain();
    AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");
    greetings = "PING!";
    MyCallBack();
    otherDomain.DoCallBack(new CrossAppDomainDelegate(MyCallBack));
    // Output:
    // PING! from default domain
    // PONG! from otherDomain
} //main
   
public static void MyCallBack()
{
    String name = AppDomain.get_CurrentDomain().get_FriendlyName();
    Console.WriteLine(greetings + " from " + name);
} //MyCallBack

値渡しによる DoCallBack メソッド使用方法次のサンプル示します

<Serializable> _
Public Class PingPong

   Private greetings As String
 = "PING!"
   
   Public Shared Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      Dim pp As New PingPong()
      pp.MyCallBack()
      pp.greetings = "PONG!"
      otherDomain.DoCallBack(AddressOf pp.MyCallBack)

      ' Output:
      '   PING! from default domain
      '   PONG! from otherDomain
   End Sub 'Main
   
   Public Sub MyCallBack()
      Dim name As String
 = AppDomain.CurrentDomain.FriendlyName
      Console.WriteLine(greetings + " from " + name)
   End Sub 'MyCallBack

End Class 'PingPong
[Serializable]
public class PingPong {
   private string greetings = "PING!";
   
   public static void Main()
 {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      PingPong pp = new PingPong();
      pp.MyCallBack();
      pp.greetings = "PONG!";
      otherDomain.DoCallBack(new CrossAppDomainDelegate(pp.MyCallBack));

      // Output:
      //   PING! from default domain
      //   PONG! from otherDomain
   }
   
   public void MyCallBack() {
      string name = AppDomain.CurrentDomain.FriendlyName;
      Console.WriteLine(greetings + " from " + name);
   }
}
[Serializable]
public ref class PingPong
{
private:
   String^ greetings;

public:
   PingPong()
   {
      greetings = "PING!";
   }

   void MyCallBack()
   {
      String^ name = AppDomain::CurrentDomain->FriendlyName;
      Console::WriteLine(  "{0} from {1}", greetings, name );
   }

   static void Ping()
   {
      AppDomain^ currentDomain = AppDomain::CurrentDomain;
      AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
      PingPong^ pp = gcnew PingPong;
      pp->MyCallBack();
      pp->greetings = "PONG!";
      otherDomain->DoCallBack( gcnew CrossAppDomainDelegate( pp, &PingPong::MyCallBack
 ) );
      
      // Output:
      //   PING! from default domain
      //   PONG! from otherDomain
   }

};

int main()
{
   PingPong::Ping();
}

/** @attribute Serializable()
 */
public class PingPong
{
    private String greetings = "PING!";

    public static void main(String[]
 args)
    {
        AppDomain currentDomain = AppDomain.get_CurrentDomain();
        AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");
        PingPong pp = new PingPong();
        pp.MyCallBack();
        pp.greetings = "PONG!";
        otherDomain.DoCallBack(new CrossAppDomainDelegate(pp.MyCallBack));
        // Output:
        // PING! from default domain
        // PONG! from otherDomain
    } //main
   
    public void MyCallBack()
    {
        String name = AppDomain.get_CurrentDomain().get_FriendlyName();
        Console.WriteLine(greetings + " from " + name);
    } //MyCallBack
} //PingPong

参照渡しによる DoCallBack メソッド使用方法次のサンプル示します

Public Class PingPong
   Inherits MarshalByRefObject

   Private greetings As String
 = "PING!"
   
   Public Shared Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      Dim pp As New PingPong()
      otherDomain.DoCallBack(AddressOf pp.MyCallBack)
      pp.MyCallBack()

      ' Output:
      '   PING! from default domain
      '   PONG! from default domain
   End Sub 'Main
   
   Public Sub MyCallBack()
      Dim name As String
 = AppDomain.CurrentDomain.FriendlyName
      Console.WriteLine((greetings + " from " + name))
      greetings = "PONG!"
   End Sub 'MyCallBack

End Class 'PingPong
public class PingPong : MarshalByRefObject
 {
   private string greetings = "PING!";
   
   public static void Main()
 {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      PingPong pp = new PingPong();
      otherDomain.DoCallBack(new CrossAppDomainDelegate(pp.MyCallBack));
      pp.MyCallBack();


      // Output:
      //   PING! from default domain
      //   PONG! from default domain
   }
   
   public void MyCallBack() {
      string name = AppDomain.CurrentDomain.FriendlyName;
      Console.WriteLine(greetings + " from " + name);
      greetings = "PONG!";
   }
}
public ref class PingPong: public
 MarshalByRefObject
{
private:
   String^ greetings;

public:
   PingPong()
   {
      greetings = "PING!";
   }

   void MyCallBack()
   {
      String^ name = AppDomain::CurrentDomain->FriendlyName;
      Console::WriteLine( "{0} from {1}", greetings, name );
      greetings = "PONG!";
   }

   static void Ping()
   {
      AppDomain^ currentDomain = AppDomain::CurrentDomain;
      AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
      PingPong^ pp = gcnew PingPong;
      otherDomain->DoCallBack( gcnew CrossAppDomainDelegate( pp, &PingPong::MyCallBack
 ) );
      pp->MyCallBack();
      
      // Output:
      //   PING! from default domain
      //   PONG! from default domain
   }

};

int main()
{
   PingPong::Ping();
}

public class PingPong extends MarshalByRefObject
{
    private String greetings = "PING!";

    public static void main(String[]
 args)
    {
        AppDomain currentDomain = AppDomain.get_CurrentDomain();
        AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");
        PingPong pp = new PingPong();
        otherDomain.DoCallBack(new CrossAppDomainDelegate(pp.MyCallBack));
        pp.MyCallBack();
        // Output:
        // PING! from default domain
        // PONG! from default domain
    } //main
    
    public void MyCallBack()
    {
        String name = AppDomain.get_CurrentDomain().get_FriendlyName();
        Console.WriteLine(greetings + " from " + name);
        greetings = "PONG!";
    } //MyCallBack
} //PingPong
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「_AppDomain.DoCallBack メソッド」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS