尝试使用各种在线转换器将此代码转换为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 { };
答案 0 :(得分: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)