ISynchronizeInvoke.BeginInvoke(Delegate, Object[]) Método

Definição

Executa o delegado de modo assíncrono no thread que criou esse objeto.Asynchronously executes the delegate on the thread that created this object.

public:
 IAsyncResult ^ BeginInvoke(Delegate ^ method, cli::array <System::Object ^> ^ args);
public IAsyncResult BeginInvoke (Delegate method, object?[]? args);
public IAsyncResult BeginInvoke (Delegate method, object[] args);
abstract member BeginInvoke : Delegate * obj[] -> IAsyncResult
Public Function BeginInvoke (method As Delegate, args As Object()) As IAsyncResult

Parâmetros

method
Delegate

Um Delegate para um método que usa parâmetros do mesmo número e tipo que aqueles contidos em args.A Delegate to a method that takes parameters of the same number and type that are contained in args.

args
Object[]

Uma matriz de tipo Object a passar como argumentos para o método em determinado.An array of type Object to pass as arguments to the given method. Pode ser null, caso nenhum argumento seja necessário.This can be null if no arguments are needed.

Retornos

IAsyncResult

Uma interface IAsyncResult que representa a operação assíncrona foi iniciada chamando esse método.An IAsyncResult interface that represents the asynchronous operation started by calling this method.

Comentários

O method delegado é executado no thread que criou o objeto, em vez do thread no qual BeginInvoke foi chamado.The method delegate is executed on the thread that created the object, instead of the thread on which BeginInvoke was called.

O delegado é chamado de forma assíncrona e esse método retorna imediatamente.The delegate is called asynchronously, and this method returns immediately. Você pode chamar esse método de qualquer thread.You can call this method from any thread. Se você precisar do valor de retorno de um processo iniciado com esse método, chame EndInvoke para obter o valor.If you need the return value from a process started with this method, call EndInvoke to get the value.

Se você precisar chamar o delegado de forma síncrona, use o Invoke método em vez disso.If you need to call the delegate synchronously, use the Invoke method instead.

Aplica-se a

Confira também