-1

I have this code that I shortened for this question:

resetButton.Clicked += async (sender, e) =>
{
   var response = await X.DisplayAlert("X","Y","Yes", "No");
};

I would like to break it out into a method so I tried this:

resetButton.Clicked += resetButtonClicked;

protected void resetButtonClicked(object sender, EventArgs e)
{
   var response = await X.DisplayAlert("X","Y","Yes", "No");
}

But this does not work as I need to specify the method to be async. Can someone give me some advice how I can do this?

Alan2
  • 23,493
  • 79
  • 256
  • 450

1 Answers1

1

This outta work.

resetButton.Clicked += resetButtonClicked;

protected async Task resetButtonClicked(object sender, EventArgs e)
{
   var response = await X.DisplayAlert("X","Y","Yes", "No");
}
Timothy Stepanski
  • 1,186
  • 7
  • 21