Search code examples
c#botframework

can i pass the value for IAwaitable<bool>


I have a bot application where i have the below method, which i want to call explicitly in specific case rather than waiting for user input. i have the context object but how can i pass the true here

//Method code

private async Task ReadItemName(IDialogContext context, IAwaitable<true> result)
{
  //
}

//Calling method: ReadItemName(context, true);

something like this but it does not accept true, but i want to pass iAwaitable type?


Solution

  • You can use AwaitableFromItem<T>:

    ReadItemName(context, new AwaitableFromItem(true));
    

    See doc here: https://learn.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.dialogs.awaitablefromitem-1?view=botbuilder-dotnet-3.0