Share via


ComponentDialog.EndComponentAsync Method

Definition

Ends the component dialog in its parent's context.

protected virtual System.Threading.Tasks.Task<Microsoft.Bot.Builder.Dialogs.DialogTurnResult> EndComponentAsync (Microsoft.Bot.Builder.Dialogs.DialogContext outerDc, object result, System.Threading.CancellationToken cancellationToken);
abstract member EndComponentAsync : Microsoft.Bot.Builder.Dialogs.DialogContext * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Builder.Dialogs.DialogTurnResult>
override this.EndComponentAsync : Microsoft.Bot.Builder.Dialogs.DialogContext * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Builder.Dialogs.DialogTurnResult>
Protected Overridable Function EndComponentAsync (outerDc As DialogContext, result As Object, cancellationToken As CancellationToken) As Task(Of DialogTurnResult)

Parameters

outerDc
DialogContext

The parent DialogContext for the current turn of conversation.

result
Object

Optional, value to return from the dialog component to the parent context.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Remarks

If the task is successful, the result indicates that the dialog ended after the turn was processed by the dialog.

In general, the parent context is the dialog or bot turn handler that started the dialog. If the parent is a dialog, the stack calls the parent's ResumeDialogAsync(DialogContext, DialogReason, Object, CancellationToken) method to return a result to the parent dialog. If the parent dialog does not implement `ResumeDialogAsync`, then the parent will end, too, and the result is passed to the next parent context, if one exists.

The returned DialogTurnResult contains the return value in its Result property.

Applies to

See also