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

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

LogicalMethodInfo.BeginInvoke メソッド

この LogicalMethodInfo で表されるメソッド非同期呼び出し開始します

名前空間: System.Web.Services.Protocols
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

Public Function BeginInvoke ( _
    target As Object, _
    values As Object(), _
    callback As AsyncCallback, _
    asyncState As Object _
) As IAsyncResult
Dim instance As LogicalMethodInfo
Dim target As Object
Dim values As Object()
Dim callback As AsyncCallback
Dim asyncState As Object
Dim returnValue As IAsyncResult

returnValue = instance.BeginInvoke(target, values, callback, asyncState)
public IAsyncResult BeginInvoke (
    Object target,
    Object[] values,
    AsyncCallback callback,
    Object asyncState
)
public:
IAsyncResult^ BeginInvoke (
    Object^ target, 
    array<Object^>^ values, 
    AsyncCallback^ callback, 
    Object^ asyncState
)
public IAsyncResult BeginInvoke (
    Object target, 
    Object[] values, 
    AsyncCallback callback, 
    Object asyncState
)
public function BeginInvoke (
    target : Object, 
    values : Object[], 
    callback : AsyncCallback, 
    asyncState : Object
) : IAsyncResult

パラメータ

target

メソッド呼び出し元となる Objectインスタンス

values

呼び出すメソッド引数リスト。これは、メソッドパラメータと同じ数、順序、型のオブジェクト配列です。メソッドパラメータ必要な場合valuesnull 参照 (Visual Basic では Nothing) です。

callback

非同期呼び出し完了したときに呼び出されるデリゲートcallbacknull 参照 (Visual Basic では Nothing) の場合、このデリゲート呼び出されません。

asyncState

デリゲート渡されるステータス情報

戻り値
リモート メソッド呼び出しからの戻り値取得するために、EndInvoke に渡される IAsyncResult。

例外例外
例外種類条件

TargetException

target パラメータnull 参照 (Visual Basic では Nothing) です。

ArgumentException

values の数、型、およびパラメータ順序が、呼び出されメソッドシグネチャ一致しません。

MemberAccessException

呼び出し元に、このメソッド呼び出すためのアクセス許可がありません。

使用例使用例
Public Shared Sub Main()

   ' Get the type information.
   ' Note: The MyMath class is a proxy class generated by the Wsdl.exe
 
   ' utility for the Math Web Service. This class can also be found
 in
   ' the SoapHttpClientProtocol class example. 
   Dim myType As Type = GetType(MyMath.MyMath)

   ' Get the method info.
   Dim myBeginMethod As MethodInfo = myType.GetMethod("BeginAdd")
   Dim myEndMethod As MethodInfo = myType.GetMethod("EndAdd")

   ' Create an instance of the LogicalMethodInfo class.
   Dim myLogicalMethodInfo As LogicalMethodInfo
 = _
      LogicalMethodInfo.Create(New MethodInfo() {myBeginMethod,
 myEndMethod}, _
      LogicalMethodTypes.Async)(0)

   ' Get an instance of the proxy class.
   Dim myMathService As New
 MyMath.MyMath()

   ' Call the MyEndIntimationMethod method to intimate the end of 
   ' the asynchronous call.
   Dim myAsyncCallback As New
 AsyncCallback(AddressOf MyEndIntimationMethod)

   ' Beging to invoke the Add method.
   Dim myAsyncResult As IAsyncResult = _
      myLogicalMethodInfo.BeginInvoke( _
      myMathService, New Object() {10, 10},
 myAsyncCallback, Nothing)

   ' Wait until invoke is complete.
   myAsyncResult.AsyncWaitHandle.WaitOne()

   ' Get the result.
   Dim myReturnValue() As Object
   myReturnValue = myLogicalMethodInfo.EndInvoke(myMathService, myAsyncResult)

   Console.WriteLine(("Sum of 10 and 10 is " &
 myReturnValue(0)))
End Sub

' This method will be called at the end of asynchronous call.
Shared Sub MyEndIntimationMethod(ByVal
 Result As IAsyncResult)
   Console.WriteLine("Asynchronous call on
 method 'Add' finished.")
End Sub

public static void Main()
{
   // Get the type information.
   // Note: The MyMath class is a proxy class generated by the Wsdl.exe
   // utility for the Math Web service. This class can also be found
 in 
   // the SoapHttpClientProtocol class example. 
   Type myType = typeof(MyMath.MyMath);

   // Get the method info.
   MethodInfo myBeginMethod = myType.GetMethod("BeginAdd");
   MethodInfo myEndMethod = myType.GetMethod("EndAdd");

   // Create an instance of the LogicalMethodInfo class.
   LogicalMethodInfo myLogicalMethodInfo = 
      (LogicalMethodInfo.Create(new MethodInfo[] {myBeginMethod
,myEndMethod},
      LogicalMethodTypes.Async))[0];

   // Get an instance of the proxy class.
   MyMath.MyMath myMathService = new MyMath.MyMath();

   // Call the MyEndIntimationMethod method to intimate the end of 
   // the asynchronous call.
   AsyncCallback myAsyncCallback = new AsyncCallback(MyEndIntimationMethod);

   // Begin to invoke the Add method.
   IAsyncResult myAsyncResult = myLogicalMethodInfo.BeginInvoke(
      myMathService,new object[]{10,10},myAsyncCallback,null);
   
   // Wait until invoke is complete.
   myAsyncResult.AsyncWaitHandle.WaitOne();
   
   // Get the result.
   object[] myReturnValue;
   myReturnValue = myLogicalMethodInfo.EndInvoke(myMathService,myAsyncResult);
   
   Console.WriteLine("Sum of 10 and 10 is " + myReturnValue[0]);
}

// This method will be called at the end of the asynchronous call.
static void MyEndIntimationMethod(IAsyncResult
 Result)
{
   Console.WriteLine("Asynchronous call on Add method finished.");
}
public:
   [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
   static void main()
   {
      // Get the type information.
      // Note: The MyMath class is a proxy class generated by the Wsdl.exe
      // utility for the Math Web service. This class can also be found
 in
      // the SoapHttpClientProtocol class example.
      Type^ myType = MyMath::MyMath::typeid;

      // Get the method info.
      MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" );
      MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" );

      // Create an instance of the LogicalMethodInfo class.
      array<MethodInfo^>^ temp0 = { myBeginMethod, myEndMethod };
      LogicalMethodInfo^ myLogicalMethodInfo =
         ( LogicalMethodInfo::Create( temp0, LogicalMethodTypes::Async ) )[ 0 ];

      // Get an instance of the proxy class.
      MyMath::MyMath^ myMathService = gcnew MyMath::MyMath;

      // Call the MyEndIntimationMethod method to intimate the end of
      // the asynchronous call.
      AsyncCallback^ myAsyncCallback = gcnew AsyncCallback( MyEndIntimationMethod
 );

      // Begin to invoke the Add method.
      array<Object^>^ temp1 = { 10, 10 };
      IAsyncResult^ myAsyncResult = myLogicalMethodInfo->BeginInvoke(
         myMathService, temp1, myAsyncCallback, nullptr );

      // Wait until invoke is complete.
      myAsyncResult->AsyncWaitHandle->WaitOne();

      // Get the result.
      array<Object^>^ myReturnValue;
      myReturnValue = myLogicalMethodInfo->EndInvoke( myMathService, myAsyncResult
 );

      Console::WriteLine( "Sum of 10 and 10 is {0}", myReturnValue[ 0 ]
 );
   }

   // This method will be called at the end of the asynchronous call.
   static void MyEndIntimationMethod( IAsyncResult^
 /*Result*/ )
   {
      Console::WriteLine( "Asynchronous call on Add method finished." );
   }
public static void main(String[]
 args)
{
    // Get the type information.
    // Note: The MyMath class is a proxy class generated by the Wsdl.exe
    // utility for the Math Web service. This class can also be found
 in 
    // the SoapHttpClientProtocol class example. 
    Type myType = MyMath.MyMath.class.ToType();

    // Get the method info.
    MethodInfo myBeginMethod = myType.GetMethod("BeginAdd");
    MethodInfo myEndMethod = myType.GetMethod("EndAdd");

    // Create an instance of the LogicalMethodInfo class.
    LogicalMethodInfo myLogicalMethodInfo = (LogicalMethodInfo)(
        LogicalMethodInfo.Create(new MethodInfo[] { myBeginMethod,
 
        myEndMethod }, LogicalMethodTypes.Async).get_Item(0));

    // Get an instance of the proxy class.
    MyMath.MyMath myMathService = new MyMath.MyMath();

    // Call the MyEndIntimationMethod method to intimate the end of
 
    // the asynchronous call.
    AsyncCallback myAsyncCallback = new AsyncCallback(MyEndIntimationMethod);

    // Begin to invoke the Add method.
    IAsyncResult myAsyncResult = myLogicalMethodInfo.BeginInvoke(
        myMathService, new Object[] { (Int32)10, (Int32)10 },
        myAsyncCallback, null);

    // Wait until invoke is complete.
    myAsyncResult.get_AsyncWaitHandle().WaitOne();

    // Get the result.
    Object myReturnValue[];
    myReturnValue = myLogicalMethodInfo.EndInvoke(myMathService, 
        myAsyncResult);

    Console.WriteLine("Sum of 10 and 10 is " + myReturnValue.get_Item(0));
} //main

// This method will be called at the end of the asynchronous call.
static void MyEndIntimationMethod(IAsyncResult
 Result)
{
    Console.WriteLine("Asynchronous call on Add method finished.");
} //MyEndIntimationMethod
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LogicalMethodInfo クラス
LogicalMethodInfo メンバ
System.Web.Services.Protocols 名前空間



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS