我在哪里标记一个lambdaexpression式asynchronous?

我有这个代码:

private async void ContextMenuForGroupRightTapped(object sender, RightTappedRoutedEventArgs args) { CheckBox ckbx = null; if (sender is CheckBox) { ckbx = sender as CheckBox; } if (null == ckbx) { return; } string groupName = ckbx.Content.ToString(); var contextMenu = new PopupMenu(); // Add a command to edit the current Group contextMenu.Commands.Add(new UICommand("Edit this Group", (contextMenuCmd) => { Frame.Navigate(typeof(LocationGroupCreator), groupName); })); // Add a command to delete the current Group contextMenu.Commands.Add(new UICommand("Delete this Group", (contextMenuCmd) => { SQLiteUtils slu = new SQLiteUtils(); slu.DeleteGroupAsync(groupName); // this line raises Resharper's hackles, but appending await raises err msg. Where should the "async" be? })); // Show the context menu at the position the image was right-clicked await contextMenu.ShowAsync(args.GetPosition(this)); } 

…… Resharper的检查抱怨说:“ 因为这个呼叫没有被等待,所以在呼叫完成之前继续执行当前的方法。考虑在呼叫结果中应用'await'操作符' (在评论)。

所以,我预先安排了一个“等待”,但当然,我还需要在某处添加一个“asynchronous”,但是在哪里呢?

要标记一个lambdaasynchronous,只需在其参数列表之前添加async

 // Add a command to delete the current Group contextMenu.Commands.Add(new UICommand("Delete this Group", async (contextMenuCmd) => { SQLiteUtils slu = new SQLiteUtils(); await slu.DeleteGroupAsync(groupName); }));