TaskFactory<TResult>.FromAsync Método

Definição

Cria uma instância de tarefa.Creates a task instance.

Sobrecargas

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>)

Cria uma tarefa que executa uma função do método de encerramento quando um IAsyncResult especificado é concluído.Creates a task that executes an end method function when a specified IAsyncResult completes.

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Cria uma tarefa que executa uma função do método de encerramento quando um IAsyncResult especificado é concluído.Creates a task that executes an end method function when a specified IAsyncResult completes.

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Cria uma tarefa que executa uma função do método de encerramento quando um IAsyncResult especificado é concluído.Creates a task that executes an end method function when a specified IAsyncResult completes.

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object)

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions)

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object)

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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>, Func<IAsyncResult,TResult>, TArg1, Object)

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions)

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>)

Cria uma tarefa que executa uma função do método de encerramento quando um IAsyncResult especificado é concluído.Creates a task that executes an end method function when a specified IAsyncResult completes.

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

Parâmetros

asyncResult
IAsyncResult

O IAsyncResult cuja conclusão deve disparar o processamento do endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

O delegado da função que processa o asyncResult concluído.The function delegate that processes the completed asyncResult.

Retornos

Task<TResult>

Um Task<TResult> que representa a operação assíncrona.A Task<TResult> that represents the asynchronous operation.

Exceções

O argumento asyncResult é null.The asyncResult argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<TResult> ^ FromAsync(Func<AsyncCallback ^, System::Object ^, IAsyncResult ^> ^ beginMethod, Func<IAsyncResult ^, TResult> ^ endMethod, System::Object ^ state);
public System.Threading.Tasks.Task<TResult> FromAsync (Func<AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object state);
public System.Threading.Tasks.Task<TResult> FromAsync (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 (beginMethod As Func(Of AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), state As Object) As Task(Of TResult)

Parâmetros

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a

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

Cria uma tarefa que executa uma função do método de encerramento quando um IAsyncResult especificado é concluído.Creates a task that executes an end method function when a specified IAsyncResult completes.

public:
 System::Threading::Tasks::Task<TResult> ^ FromAsync(IAsyncResult ^ asyncResult, Func<IAsyncResult ^, TResult> ^ endMethod, System::Threading::Tasks::TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync (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 (asyncResult As IAsyncResult, endMethod As Func(Of IAsyncResult, TResult), creationOptions As TaskCreationOptions) As Task(Of TResult)

Parâmetros

asyncResult
IAsyncResult

O IAsyncResult cuja conclusão deve disparar o processamento do endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

O delegado da função que processa o asyncResult concluído.The function delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions

Um dos valores de enumeração que controla o comportamento da tarefa criada.One of the enumeration values that controls the behavior of the created task.

Retornos

Task<TResult>

Uma tarefa que representa a operação assíncrona.A task that represents the asynchronous operation.

Exceções

O argumento asyncResult é null.The asyncResult argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

O argumento creationOptions especifica um valor inválido.The creationOptions argument specifies an invalid value.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<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 (Func<AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync (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 (beginMethod As Func(Of AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), state As Object, creationOptions As TaskCreationOptions) As Task(Of TResult)

Parâmetros

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

Um dos valores de enumeração que controla o comportamento da tarefa criada.One of the enumeration values that controls the behavior of the created task.

Retornos

Task<TResult>

O Task<TResult> criado que representa a operação assíncrona.The created Task<TResult> that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

O argumento creationOptions especifica um valor inválido.The creationOptions argument specifies an invalid value.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a

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

Cria uma tarefa que executa uma função do método de encerramento quando um IAsyncResult especificado é concluído.Creates a task that executes an end method function when a specified IAsyncResult completes.

public:
 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 (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 (asyncResult As IAsyncResult, endMethod As Func(Of IAsyncResult, TResult), creationOptions As TaskCreationOptions, scheduler As TaskScheduler) As Task(Of TResult)

Parâmetros

asyncResult
IAsyncResult

O IAsyncResult cuja conclusão deve disparar o processamento do endMethod.The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

O delegado da função que processa o asyncResult concluído.The function delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions

Um dos valores de enumeração que controla o comportamento da tarefa criada.One of the enumeration values that controls the behavior of the created task.

scheduler
TaskScheduler

O agendador de tarefas usado para agendar a tarefa que executa o método de encerramento.The task scheduler that is used to schedule the task that executes the end method.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento asyncResult é null.The asyncResult argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

- ou --or- O argumento scheduler é null.The scheduler argument is null.

O parâmetro creationOptions especifica um valor inválido.The creationOptions parameter specifies an invalid value.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<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> (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);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3> (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) (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)

Parâmetros de tipo

TArg1

O tipo do segundo argumento passado para o delegado beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

O tipo do terceiro argumento passado para o delegado beginMethod.The type of the third argument passed to beginMethod delegate.

TArg3

O tipo do primeiro argumento passado para o delegado beginMethod.The type of the first argument passed to the beginMethod delegate.

Parâmetros

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

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

arg1
TArg1

O primeiro argumento passado para o delegado beginMethod.The first argument passed to the beginMethod delegate.

arg2
TArg2

O segundo argumento passado para o delegado beginMethod.The second argument passed to the beginMethod delegate.

arg3
TArg3

O terceiro argumento passado para o delegado beginMethod.The third argument passed to the beginMethod delegate.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

Um objeto que controla o comportamento da tarefa criada.An object that controls the behavior of the created task.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

O parâmetro creationOptions especifica um valor inválido.The creationOptions parameter specifies an invalid value.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<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> (Func<TArg1,TArg2,TArg3,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3> (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) (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)

Parâmetros de tipo

TArg1

O tipo do segundo argumento passado para o delegado beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

O tipo do terceiro argumento passado para o delegado beginMethod.The type of the third argument passed to beginMethod delegate.

TArg3

O tipo do primeiro argumento passado para o delegado beginMethod.The type of the first argument passed to the beginMethod delegate.

Parâmetros

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

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

arg1
TArg1

O primeiro argumento passado para o delegado beginMethod.The first argument passed to the beginMethod delegate.

arg2
TArg2

O segundo argumento passado para o delegado beginMethod.The second argument passed to the beginMethod delegate.

arg3
TArg3

O terceiro argumento passado para o delegado beginMethod.The third argument passed to the beginMethod delegate.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<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> (Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2> (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) (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)

Parâmetros de tipo

TArg1

O tipo do segundo argumento passado para o delegado beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

O tipo do primeiro argumento passado para o delegado beginMethod.The type of the first argument passed to the beginMethod delegate.

Parâmetros

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

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

arg1
TArg1

O primeiro argumento passado para o delegado beginMethod.The first argument passed to the beginMethod delegate.

arg2
TArg2

O segundo argumento passado para o delegado beginMethod.The second argument passed to the beginMethod delegate.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

Um objeto que controla o comportamento da Task<TResult> criada.An object that controls the behavior of the created Task<TResult>.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

O parâmetro creationOptions especifica um valor inválido.The creationOptions parameter specifies an invalid value.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<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> (Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2> (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) (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)

Parâmetros de tipo

TArg1

O tipo do segundo argumento passado para o delegado beginMethod.The type of the second argument passed to beginMethod delegate.

TArg2

O tipo do primeiro argumento passado para o delegado beginMethod.The type of the first argument passed to the beginMethod delegate.

Parâmetros

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

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

arg1
TArg1

O primeiro argumento passado para o delegado beginMethod.The first argument passed to the beginMethod delegate.

arg2
TArg2

O segundo argumento passado para o delegado beginMethod.The second argument passed to the beginMethod delegate.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<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> (Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1> (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) (beginMethod As Func(Of TArg1, AsyncCallback, Object, IAsyncResult), endMethod As Func(Of IAsyncResult, TResult), arg1 As TArg1, state As Object) As Task(Of TResult)

Parâmetros de tipo

TArg1

O tipo do primeiro argumento passado para o delegado beginMethod.The type of the first argument passed to the beginMethod delegate.

Parâmetros

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

arg1
TArg1

O primeiro argumento passado para o delegado beginMethod.The first argument passed to the beginMethod delegate.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a

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

Cria uma tarefa que representa um par de métodos de início e de encerramento que estão em conformidade com o padrão do Modelo de Programação Assíncrona.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<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> (Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1> (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) (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)

Parâmetros de tipo

TArg1

O tipo do primeiro argumento passado para o delegado beginMethod.The type of the first argument passed to the beginMethod delegate.

Parâmetros

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

O delegado que inicia a operação assíncrona.The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

O delegado que finaliza a operação assíncrona.The delegate that ends the asynchronous operation.

arg1
TArg1

O primeiro argumento passado para o delegado beginMethod.The first argument passed to the beginMethod delegate.

state
Object

Um objeto que contém dados a serem usados pelo delegado beginMethod.An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

Um dos valores de enumeração que controla o comportamento da tarefa criada.One of the enumeration values that controls the behavior of the created task.

Retornos

Task<TResult>

A tarefa criada que representa a operação assíncrona.The created task that represents the asynchronous operation.

Exceções

O argumento beginMethod é null.The beginMethod argument is null.

- ou --or- O argumento endMethod é null.The endMethod argument is null.

O parâmetro creationOptions especifica um valor inválido.The creationOptions parameter specifies an invalid value.

Comentários

Esse método gera exceções geradas pelo beginMethod .This method throws any exceptions thrown by the beginMethod. As exceções para endmethod são geradas ao aguardar a tarefa retornada.Exceptions for endmethod are thrown when waiting on the returned task.

Aplica-se a