简体   繁体   English

将C#代码转换为VB.NET错误

[英]Converting c# code to VB.NET error

I tried converting my c# code below to VB and I got Events cannot be declared with a delegate type that has a return type 我尝试将下面的C#代码转换为VB,但我无法使用具有返回类型的委托类型声明事件

in C# 在C#中

internal static event GenericDelegate<Boolean, Boolean> SecurityAlertDialogWillBeShown;
    internal static event GenericDelegate<String, String, Boolean> ConnectToDialogWillBeShown;

`In vb.net 在vb.net中

Friend Shared Event SecurityAlertDialogWillBeShown As GenericDelegate(Of [Boolean], [Boolean])
    Friend Shared Event ConnectToDialogWillBeShown As GenericDelegate(Of [String], [String], [Boolean])

any idea appreciated. 任何想法表示赞赏。

In VB.Net, you can't create an Event with a delegate type that has a return type (well, the error message already told you that). 在VB.Net中,您不能创建具有返回类型的委托类型的Event (嗯,错误消息已经告诉您了)。

You have to declare your delegate ( GenericDelegate ) as Sub instead of Function . 您必须将您的委托( GenericDelegate )声明为Sub而不是Function

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM