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

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

AsyncResult.AsyncState プロパティ

BeginInvoke メソッド呼び出し最後パラメータ指定されオブジェクト取得します

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

Public Overridable ReadOnly
 Property AsyncState As Object
Dim instance As AsyncResult
Dim value As Object

value = instance.AsyncState
public virtual Object AsyncState { get; }
/** @property */
public Object get_AsyncState ()

プロパティ
BeginInvoke メソッド呼び出し最後パラメータ指定されオブジェクト

解説解説
使用例使用例

AsyncState プロパティ使用してBeginInvoke メソッド呼び出し最後パラメータ取得する方法次のコード例示しますプログラム例全体については、AsyncResult クラストピックの例を参照してください

' Asynchronous Callback method.
Public Shared Sub MyCallback(ar
 As IAsyncResult)
   ' Obtains the last parameter of the delegate call.
   Dim value As Integer
 = Convert.ToInt32(ar.AsyncState)
   
   ' Obtains return value from the delegate call using EndInvoke.
   Dim aResult As AsyncResult = CType(ar, AsyncResult)
   Dim temp As SampSyncSqrDelegate = CType(aResult.AsyncDelegate,
 SampSyncSqrDelegate)
   Dim result As Integer
 = temp.EndInvoke(ar)
   
   Console.Write("Simple.SomeMethod (AsyncCallback): Result of
 ")
   Console.WriteLine("{0} in SampleSynchronized.Square is {1}
 ", value, result)
End Sub 'MyCallback  
// Asynchronous Callback method.
public static void MyCallback(IAsyncResult
 ar) {

    // Obtains the last parameter of the delegate call.
    int value = Convert.ToInt32(ar.AsyncState);

    // Obtains return value from the delegate call using EndInvoke.
    AsyncResult aResult = (AsyncResult)ar;
    SampSyncSqrDelegate temp = (SampSyncSqrDelegate)aResult.AsyncDelegate;
    int result = temp.EndInvoke(ar);

    Console.Write("Simple.SomeMethod (AsyncCallback): Result of ");
    Console.WriteLine("{0} in SampleSynchronized.Square is
 {1} ", value, result);
}
// Asynchronous Callback method.
static void MyCallback( IAsyncResult^ ar )
{
   
   // Obtains the last parameter of the delegate call.
   int value = Convert::ToInt32( ar->AsyncState );
   
   // Obtains return value from the delegate call using EndInvoke.
   AsyncResult^ aResult = dynamic_cast<AsyncResult^>(ar);
   SampSyncSqrDelegate^ temp = static_cast<SampSyncSqrDelegate^>(aResult->AsyncDelegate);
   int result = temp->EndInvoke( ar );
   Console::Write( "Simple::SomeMethod (AsyncCallback): Result of " );
   Console::WriteLine( " {0} in SampleSynchronized::Square
 is {1} ", value, result );
}

// Asynchronous Callback method.
public static void MyCallback(IAsyncResult
 ar)
{
    // Obtains the last parameter of the delegate call.
    SampSyncSqrDelegate sampDelg = (SampSyncSqrDelegate)ar.get_AsyncState();
    
    // Obtains return value from the delegate call using EndInvoke.
    AsyncResult aResult = (AsyncResult)ar;
    SampSyncSqrDelegate temp =
        (SampSyncSqrDelegate)(aResult.get_AsyncDelegate());
    int threadId = AppDomain.GetCurrentThreadId();
    int result = temp.EndInvoke(ar);

    Console.Write("Simple.SomeMethod (AsyncCallback): Result of ");
    Console.WriteLine("{0} in SampleSynchronized.Square is
 {1} ",
        (Int32)value, (Int32)result);
} //MyCallback
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「AsyncResult.AsyncState プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS