TaskFactory.FromAsync TaskFactory.FromAsync TaskFactory.FromAsync TaskFactory.FromAsync Method

Definizione

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

Overload

FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>)

Crea un oggetto Task che esegue un'azione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task that executes an end method action when a specified IAsyncResult completes.

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions)

Crea un oggetto Task che esegue un'azione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task that executes an end method action when a specified IAsyncResult completes.

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler)

Crea un oggetto Task che esegue un'azione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task that executes an end method action when a specified IAsyncResult completes.

FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler)

Crea un oggetto Task<TResult> che esegue una funzione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions)

Crea un oggetto Task<TResult> che esegue una funzione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>)

Crea un oggetto Task<TResult> che esegue una funzione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>)

Crea un oggetto Task che esegue un'azione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task that executes an end method action when a specified IAsyncResult completes.

public:
 System::Threading::Tasks::Task ^ FromAsync(IAsyncResult ^ asyncResult, Action<IAsyncResult ^> ^ endMethod);
public System.Threading.Tasks.Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod);
member this.FromAsync : IAsyncResult * Action<IAsyncResult> -> System.Threading.Tasks.Task
Public Function FromAsync (asyncResult As IAsyncResult, endMethod As Action(Of IAsyncResult)) As Task

Parametri

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult il cui completamento deve attivare l'elaborazione di endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Action<IAsyncResult>

Delegato dell'azione che elabora l'oggetto asyncResult completato.The action delegate that processes the completed asyncResult.

Restituisce

Oggetto Task che rappresenta l'operazione asincrona.A Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento asyncResult è Null.The exception that is thrown when the asyncResult argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Suggerimento

Il FromAsync esegue l'overload che accettano un' asyncResult parametri non sono più efficienti gli overload che accettano un beginMethod parametro.The FromAsync overloads that take an asyncResult parameter are not as efficient as the overloads that take a beginMethod parameter. Se le prestazioni costituiscono un problema, usare gli overload che forniscono i beginMethod / endMethod pattern.If performance is an issue, use the overloads that provide the beginMethod/endMethod pattern.

Vedi anche

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
 System::Threading::Tasks::Task ^ FromAsync(Func<AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, System::Object ^ state);
public System.Threading.Tasks.Task FromAsync (Func<AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object state);
member this.FromAsync : Func<AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * obj -> System.Threading.Tasks.Task
Public Function FromAsync (beginMethod As Func(Of AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), state As Object) As Task

Parametri

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions)

Crea un oggetto Task che esegue un'azione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task that executes an end method action when a specified IAsyncResult completes.

public:
 System::Threading::Tasks::Task ^ FromAsync(IAsyncResult ^ asyncResult, Action<IAsyncResult ^> ^ endMethod, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : IAsyncResult * Action<IAsyncResult> * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task
Public Function FromAsync (asyncResult As IAsyncResult, endMethod As Action(Of IAsyncResult), creationOptions As TaskCreationOptions) As Task

Parametri

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult il cui completamento deve attivare l'elaborazione di endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Action<IAsyncResult>

Delegato dell'azione che elabora l'oggetto asyncResult completato.The action delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task creato.The TaskCreationOptions value that controls the behavior of the created Task.

Restituisce

Oggetto Task che rappresenta l'operazione asincrona.A Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento asyncResult è Null.The exception that is thrown when the asyncResult argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Suggerimento

Il FromAsync esegue l'overload che accettano un' asyncResult parametri non sono più efficienti gli overload che accettano un beginMethod parametro.The FromAsync overloads that take an asyncResult parameter are not as efficient as the overloads that take a beginMethod parameter. Se le prestazioni costituiscono un problema, usare gli overload che forniscono i beginMethod / endMethod pattern.If performance is an issue, use the overloads that provide the beginMethod/endMethod pattern.

Vedi anche

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
 System::Threading::Tasks::Task ^ FromAsync(Func<AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task FromAsync (Func<AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task
Public Function FromAsync (beginMethod As Func(Of AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), state As Object, creationOptions As TaskCreationOptions) As Task

Parametri

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task creato.The TaskCreationOptions value that controls the behavior of the created Task.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod. Il TaskCreationOptions i valori PreferFairness, LongRunning e AttachedToParent sono tutti si escludono a vicenda.The TaskCreationOptions values PreferFairness, LongRunning and AttachedToParent are all mutually exclusive. I metodi di FromAsync, sia LongRunning oppure AttachedToParent autonomamente causerà un ArgumentOutOfRangeException eccezione.In the FromAsync methods, either LongRunning or AttachedToParent by themselves will cause an ArgumentOutOfRangeException to be thrown.

Vedi anche

FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler)

Crea un oggetto Task che esegue un'azione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task that executes an end method action when a specified IAsyncResult completes.

public:
 System::Threading::Tasks::Task ^ FromAsync(IAsyncResult ^ asyncResult, Action<IAsyncResult ^> ^ endMethod, System::Threading::Tasks::TaskCreationOptions creationOptions, System::Threading::Tasks::TaskScheduler ^ scheduler);
public System.Threading.Tasks.Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler);
member this.FromAsync : IAsyncResult * Action<IAsyncResult> * System.Threading.Tasks.TaskCreationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.Task
Public Function FromAsync (asyncResult As IAsyncResult, endMethod As Action(Of IAsyncResult), creationOptions As TaskCreationOptions, scheduler As TaskScheduler) As Task

Parametri

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult il cui completamento deve attivare l'elaborazione di endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Action<IAsyncResult>

Delegato dell'azione che elabora l'oggetto asyncResult completato.The action delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task creato.The TaskCreationOptions value that controls the behavior of the created Task.

scheduler
TaskScheduler TaskScheduler TaskScheduler TaskScheduler

Oggetto TaskScheduler utilizzato per pianificare l'attività che esegue il metodo End.The TaskScheduler that is used to schedule the task that executes the end method.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento asyncResult è Null.The exception that is thrown when the asyncResult argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento scheduler è Null.The exception that is thrown when the scheduler argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Suggerimento

Il FromAsync esegue l'overload che accettano un' asyncResult parametri non sono più efficienti gli overload che accettano un beginMethod parametro.The FromAsync overloads that take an asyncResult parameter are not as efficient as the overloads that take a beginMethod parameter. Se le prestazioni costituiscono un problema, usare gli overload che forniscono i beginMethod / endMethod pattern.If performance is an issue, use the overloads that provide the beginMethod/endMethod pattern.

Vedi anche

FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2, typename TArg3, typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<TArg1, TArg2, TArg3, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3,TResult> (Func<TArg1,TArg2,TArg3,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<'TArg1, 'TArg2, 'TArg3, AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * 'TArg1 * 'TArg2 * 'TArg3 * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TArg1, TArg2, TArg3, TResult) (beginMethod As Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), arg1 As TArg1, arg2 As TArg2, arg3 As TArg3, state As Object, creationOptions As TaskCreationOptions) As Task(Of TResult)

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del terzo argomento passato al delegato beginMethod.The type of the third argument passed to beginMethod delegate.

TArg3

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

arg3

Terzo argomento passato al delegato beginMethod.The third argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task<TResult> creato.The TaskCreationOptions value that controls the behavior of the created Task<TResult>.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3,TResult>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2, typename TArg3, typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<TArg1, TArg2, TArg3, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, System::Object ^ state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3,TResult> (Func<TArg1,TArg2,TArg3,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state);
member this.FromAsync : Func<'TArg1, 'TArg2, 'TArg3, AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * 'TArg1 * 'TArg2 * 'TArg3 * obj -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TArg1, TArg2, TArg3, TResult) (beginMethod As Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), arg1 As TArg1, arg2 As TArg2, arg3 As TArg3, state As Object) As Task(Of TResult)

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del terzo argomento passato al delegato beginMethod.The type of the third argument passed to beginMethod delegate.

TArg3

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

arg3

Terzo argomento passato al delegato beginMethod.The third argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2, typename TArg3>
 System::Threading::Tasks::Task ^ FromAsync(Func<TArg1, TArg2, TArg3, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task FromAsync<TArg1,TArg2,TArg3> (Func<TArg1,TArg2,TArg3,AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<'TArg1, 'TArg2, 'TArg3, AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * 'TArg1 * 'TArg2 * 'TArg3 * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task
Public Function FromAsync(Of TArg1, TArg2, TArg3) (beginMethod As Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), arg1 As TArg1, arg2 As TArg2, arg3 As TArg3, state As Object, creationOptions As TaskCreationOptions) As Task

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del terzo argomento passato al delegato beginMethod.The type of the third argument passed to beginMethod delegate.

TArg3

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

Parametri

beginMethod
Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

arg3

Terzo argomento passato al delegato beginMethod.The third argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task creato.The TaskCreationOptions value that controls the behavior of the created Task.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2, typename TArg3>
 System::Threading::Tasks::Task ^ FromAsync(Func<TArg1, TArg2, TArg3, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, System::Object ^ state);
public System.Threading.Tasks.Task FromAsync<TArg1,TArg2,TArg3> (Func<TArg1,TArg2,TArg3,AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state);
member this.FromAsync : Func<'TArg1, 'TArg2, 'TArg3, AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * 'TArg1 * 'TArg2 * 'TArg3 * obj -> System.Threading.Tasks.Task
Public Function FromAsync(Of TArg1, TArg2, TArg3) (beginMethod As Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), arg1 As TArg1, arg2 As TArg2, arg3 As TArg3, state As Object) As Task

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del terzo argomento passato al delegato beginMethod.The type of the third argument passed to beginMethod delegate.

TArg3

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

Parametri

beginMethod
Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

arg3

Terzo argomento passato al delegato beginMethod.The third argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2, typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<TArg1, TArg2, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, TArg1 arg1, TArg2 arg2, System::Object ^ state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TResult> (Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object state);
member this.FromAsync : Func<'TArg1, 'TArg2, AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * 'TArg1 * 'TArg2 * obj -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TArg1, TArg2, TResult) (beginMethod As Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), arg1 As TArg1, arg2 As TArg2, state As Object) As Task(Of TResult)

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TResult>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2, typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<TArg1, TArg2, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, TArg1 arg1, TArg2 arg2, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TResult> (Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<'TArg1, 'TArg2, AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * 'TArg1 * 'TArg2 * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TArg1, TArg2, TResult) (beginMethod As Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), arg1 As TArg1, arg2 As TArg2, state As Object, creationOptions As TaskCreationOptions) As Task(Of TResult)

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task<TResult> creato.The TaskCreationOptions value that controls the behavior of the created Task<TResult>.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2>
 System::Threading::Tasks::Task ^ FromAsync(Func<TArg1, TArg2, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, TArg1 arg1, TArg2 arg2, System::Object ^ state);
public System.Threading.Tasks.Task FromAsync<TArg1,TArg2> (Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object state);
member this.FromAsync : Func<'TArg1, 'TArg2, AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * 'TArg1 * 'TArg2 * obj -> System.Threading.Tasks.Task
Public Function FromAsync(Of TArg1, TArg2) (beginMethod As Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), arg1 As TArg1, arg2 As TArg2, state As Object) As Task

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

Parametri

beginMethod
Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TArg2>
 System::Threading::Tasks::Task ^ FromAsync(Func<TArg1, TArg2, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, TArg1 arg1, TArg2 arg2, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task FromAsync<TArg1,TArg2> (Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<'TArg1, 'TArg2, AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * 'TArg1 * 'TArg2 * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task
Public Function FromAsync(Of TArg1, TArg2) (beginMethod As Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), arg1 As TArg1, arg2 As TArg2, state As Object, creationOptions As TaskCreationOptions) As Task

Parametri di tipo

TArg1

Tipo del secondo argomento passato al delegato beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

Parametri

beginMethod
Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

arg2

Secondo argomento passato al delegato beginMethod.The second argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task creato.The TaskCreationOptions value that controls the behavior of the created Task.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<TArg1, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, TArg1 arg1, System::Object ^ state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TResult> (Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object state);
member this.FromAsync : Func<'TArg1, AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * 'TArg1 * obj -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TArg1, TResult) (beginMethod As Func(Of TArg1, AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), arg1 As TArg1, state As Object) As Task(Of TResult)

Parametri di tipo

TArg1

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1,TResult>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1, typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<TArg1, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, TArg1 arg1, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TResult> (Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<'TArg1, AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * 'TArg1 * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TArg1, TResult) (beginMethod As Func(Of TArg1, AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), arg1 As TArg1, state As Object, creationOptions As TaskCreationOptions) As Task(Of TResult)

Parametri di tipo

TArg1

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task<TResult> creato.The TaskCreationOptions value that controls the behavior of the created Task<TResult>.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1>
 System::Threading::Tasks::Task ^ FromAsync(Func<TArg1, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, TArg1 arg1, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task FromAsync<TArg1> (Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<'TArg1, AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * 'TArg1 * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task
Public Function FromAsync(Of TArg1) (beginMethod As Func(Of TArg1, AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), arg1 As TArg1, state As Object, creationOptions As TaskCreationOptions) As Task

Parametri di tipo

TArg1

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

Parametri

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task creato.The TaskCreationOptions value that controls the behavior of the created Task.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object)

Crea un oggetto Task che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TArg1>
 System::Threading::Tasks::Task ^ FromAsync(Func<TArg1, AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Action<IAsyncResult ^> ^ endMethod, TArg1 arg1, System::Object ^ state);
public System.Threading.Tasks.Task FromAsync<TArg1> (Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, TArg1 arg1, object state);
member this.FromAsync : Func<'TArg1, AsyncCallback, obj, IAsyncResult> * Action<IAsyncResult> * 'TArg1 * obj -> System.Threading.Tasks.Task
Public Function FromAsync(Of TArg1) (beginMethod As Func(Of TArg1, AsyncCallback, Object, IAsyncResult), endMethod As Action(Of IAsyncResult), arg1 As TArg1, state As Object) As Task

Parametri di tipo

TArg1

Tipo del primo argomento passato al delegato beginMethod.The type of the first argument passed to the beginMethod delegate.

Parametri

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Action<IAsyncResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

arg1

Primo argomento passato al delegato beginMethod.The first argument passed to the beginMethod delegate.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task creato che rappresenta l'operazione asincrona.The created Task that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Il beginMethod delegato viene avviato sul thread che FromAsync è in esecuzione.The beginMethod delegate is started on the thread that FromAsync is running on. Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler)

Crea un oggetto Task<TResult> che esegue una funzione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

public:
generic <typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(IAsyncResult ^ asyncResult, Func<IAsyncResult ^, TResult> ^ endMethod, System::Threading::Tasks::TaskCreationOptions creationOptions, System::Threading::Tasks::TaskScheduler ^ scheduler);
public System.Threading.Tasks.Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult,TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler);
member this.FromAsync : IAsyncResult * Func<IAsyncResult, 'Result> * System.Threading.Tasks.TaskCreationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TResult) (asyncResult As IAsyncResult, endMethod As Func(Of IAsyncResult, TResult), creationOptions As TaskCreationOptions, scheduler As TaskScheduler) As Task(Of TResult)

Parametri di tipo

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult il cui completamento deve attivare l'elaborazione di endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

Delegato della funzione che elabora l'oggetto asyncResult completato.The function delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task<TResult> creato.The TaskCreationOptions value that controls the behavior of the created Task<TResult>.

scheduler
TaskScheduler TaskScheduler TaskScheduler TaskScheduler

Oggetto TaskScheduler utilizzato per pianificare l'attività che esegue il metodo End.The TaskScheduler that is used to schedule the task that executes the end method.

Restituisce

Oggetto Task<TResult> che rappresenta l'operazione asincrona.A Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento asyncResult è Null.The exception that is thrown when the asyncResult argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento scheduler è Null.The exception that is thrown when the scheduler argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Suggerimento

Il FromAsync esegue l'overload che accettano un' asyncResult parametri non sono più efficienti gli overload che accettano un beginMethod parametro.The FromAsync overloads that take an asyncResult parameter are not as efficient as the overloads that take a beginMethod parameter. Se le prestazioni costituiscono un problema, usare gli overload che forniscono i beginMethod / endMethod pattern.If performance is an issue, use the overloads that provide the beginMethod/endMethod pattern.

Vedi anche

FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions)

Crea un oggetto Task<TResult> che esegue una funzione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

public:
generic <typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(IAsyncResult ^ asyncResult, Func<IAsyncResult ^, TResult> ^ endMethod, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult,TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : IAsyncResult * Func<IAsyncResult, 'Result> * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TResult) (asyncResult As IAsyncResult, endMethod As Func(Of IAsyncResult, TResult), creationOptions As TaskCreationOptions) As Task(Of TResult)

Parametri di tipo

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult il cui completamento deve attivare l'elaborazione di endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

Delegato della funzione che elabora l'oggetto asyncResult completato.The function delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task<TResult> creato.The TaskCreationOptions value that controls the behavior of the created Task<TResult>.

Restituisce

Oggetto Task<TResult> che rappresenta l'operazione asincrona.A Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento asyncResult è Null.The exception that is thrown when the asyncResult argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Suggerimento

Il FromAsync esegue l'overload che accettano un' asyncResult parametri non sono più efficienti gli overload che accettano un beginMethod parametro.The FromAsync overloads that take an asyncResult parameter are not as efficient as the overloads that take a beginMethod parameter. Se le prestazioni costituiscono un problema, usare gli overload che forniscono i beginMethod / endMethod pattern.If performance is an issue, use the overloads that provide the beginMethod/endMethod pattern.

Vedi anche

FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, System::Object ^ state);
public System.Threading.Tasks.Task<TResult> FromAsync<TResult> (Func<AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object state);
member this.FromAsync : Func<AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * obj -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TResult) (beginMethod As Func(Of AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), state As Object) As Task(Of TResult)

Parametri di tipo

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync<TResult>(IAsyncResult, Func<IAsyncResult,TResult>)

Crea un oggetto Task<TResult> che esegue una funzione del metodo End al completamento di un oggetto IAsyncResult specificato.Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

public:
generic <typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(IAsyncResult ^ asyncResult, Func<IAsyncResult ^, TResult> ^ endMethod);
public System.Threading.Tasks.Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult,TResult> endMethod);
member this.FromAsync : IAsyncResult * Func<IAsyncResult, 'Result> -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TResult) (asyncResult As IAsyncResult, endMethod As Func(Of IAsyncResult, TResult)) As Task(Of TResult)

Parametri di tipo

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult il cui completamento deve attivare l'elaborazione di endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

Delegato della funzione che elabora l'oggetto asyncResult completato.The function delegate that processes the completed asyncResult.

Restituisce

Oggetto Task<TResult> che rappresenta l'operazione asincrona.A Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento asyncResult è Null.The exception that is thrown when the asyncResult argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Commenti

Suggerimento

Il FromAsync esegue l'overload che accettano un' asyncResult parametri non sono più efficienti gli overload che accettano un beginMethod parametro.The FromAsync overloads that take an asyncResult parameter are not as efficient as the overloads that take a beginMethod parameter. Se le prestazioni costituiscono un problema, usare gli overload che forniscono i beginMethod / endMethod pattern.If performance is an issue, use the overloads that provide the beginMethod/endMethod pattern.

Vedi anche

FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync<TResult>(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions)

Crea un oggetto Task<TResult> che rappresenta una coppia di metodi Begin ed End conformi al modello di programmazione asincrona.Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public:
generic <typename TResult>
 System::Threading::Tasks::Task<TResult> ^ FromAsync(Func<AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, System::Object ^ state, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TResult> (Func<AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
member this.FromAsync : Func<AsyncCallback, obj, IAsyncResult> * Func<IAsyncResult, 'Result> * obj * System.Threading.Tasks.TaskCreationOptions -> System.Threading.Tasks.Task<'Result>
Public Function FromAsync(Of TResult) (beginMethod As Func(Of AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), state As Object, creationOptions As TaskCreationOptions) As Task(Of TResult)

Parametri di tipo

TResult

Tipo del risultato disponibile tramite Task<TResult>.The type of the result available through the Task<TResult>.

Parametri

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

Delegato che inizia l'operazione asincrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

Delegato che termina l'operazione asincrona.The delegate that ends the asynchronous operation.

state
Object Object Object Object

Oggetto contenente i dati che devono essere utilizzati dal delegato beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions TaskCreationOptions TaskCreationOptions TaskCreationOptions

Valore di TaskCreationOptions che controlla il comportamento dell'oggetto Task<TResult> creato.The TaskCreationOptions value that controls the behavior of the created Task<TResult>.

Restituisce

Oggetto Task<TResult> creato che rappresenta l'operazione asincrona.The created Task<TResult> that represents the asynchronous operation.

Eccezioni

Eccezione generata quando l'argomento beginMethod è Null.The exception that is thrown when the beginMethod argument is null.

In alternativa-or- Eccezione generata quando l'argomento endMethod è Null.The exception that is thrown when the endMethod argument is null.

Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Eccezione generata quando l'argomento creationOptions specifica un valore TaskCreationOptions non valido.The exception that is thrown when the creationOptions argument specifies an invalid TaskCreationOptions value. Per ulteriori informazioni, vedere la sezione Osservazioni di FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

Commenti

Questo metodo genera le eccezioni generate dal beginMethod.This method throws any exceptions thrown by the beginMethod.

Vedi anche

Si applica a