1

尝试使用各种在线转换器将此代码转换为 VB.NET,但均无效(事件处理程序声明出错)。我正在使用 VS 2012 和 .Net 4.5。有任何想法吗?

readonly Action<IDialogManager, Action<bool>> closeCheck;

public void Execute(ActionExecutionContext context) {
        closeCheck(Shell.Dialogs, result => Completed(this, new ResultCompletionEventArgs { WasCancelled = !result }));
    }

public event EventHandler<ResultCompletionEventArgs> Completed = delegate { };
4

1 回答 1

0

我在 LinqPad 中创建了虚拟类型并得到了这个:

ReadOnly closeCheck As Action(Of IDialogManager, Action(Of Boolean))

Public Sub Execute(ByVal Context As ActionExecutionContext)
    closeCheck(Shell.Dialogs, Sub(Result) RaiseEvent Completed(Me, New ResultCompletionEventArgs With { .WasCancelled = Not Result }))
End Sub

Public Event Completed As EventHandler(Of ResultCompletionEventArgs)
于 2013-08-16T17:25:50.227 回答