帮助将c#代码转换为vb.net [英] Help to Convert c# code to vb.net

查看:74
本文介绍了帮助将c#代码转换为vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮我转换为vb.net吗?



can anyone help me to convert this to vb.net?

public event EventHandler<AppointmentEditEventArgs> AppointmentEdit;
 protected void FireAppointmentEdit(Appointment appointment)
        {
                EventHandler<AppointmentEditEventArgs> handler = AppointmentEdit;
                if (handler != null)
                {
                    AppointmentEditEventArgs args = new AppointmentEditEventArgs(appointment,this);
                    handler(this, args);
                }

        }





我尝试了一些在线转换工具,但收到错误公共活动AppointmentEdit(Sender as Object,e as Events.AppointmentEditEventArgs)是一个事件,不能直接调用。使用RaiseEvent语句引发事件。在vb.net在线转换版本下面。





I tried few online conversion tools but getting an error "Public Event AppointmentEdit(Sender as Object, e as Events.AppointmentEditEventArgs) is an event, and cannot be called directly. use a RaiseEvent statement to raise an event. Below the vb.net online converted version.

Public Event AppointmentEdit As EventHandler(Of AppointmentEditEventArgs)
Protected Sub FireAppointmentEdit(appointment As Appointment)
    Dim handler As EventHandler(Of AppointmentEditEventArgs) = AppointmentEdit
    If handler IsNot Nothing Then
        Dim args As New AppointmentEditEventArgs(appointment, Me)
        handler(Me, args)
    End If

End Sub

推荐答案





查看此...

http:// www。 developerfusion.com/tools/convert/csharp-to-vb/ [ ^ ]



希望这会对你有所帮助。



欢呼s
Hi,

Check this...
http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]

Hope this will help you.

Cheers


这应该教你两件事:

1.所有那些在线(离线)代码转换器都是无脑的,无法从代码本身知道函数调用是函数调用或处理程序调用(C#中没有语法差异)

2.永远不要去VB ...



你需要做的是理解错误并为自己修复语法错误(自动转换只能带你到那么远)...



< a href =https://msdn.microsoft.com/en-us/library/fwd3bwed.aspx> RaiseEvent for VB [ ^ ]
And that should teach you two things:
1. All those online (offline too) code converters are brainless and can't know from the code itself that a function call is function call or handler call (there is no syntax difference in C#)
2. Never go for VB...

What you have to do is to understand the error and fix the syntax errors for yourself (an automatic conversion can take you that far only)...

RaiseEvent for VB[^]


这篇关于帮助将c#代码转换为vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆