关于c#和vb中的语法

时间:2009-08-07 05:33:28

标签: asp.net vb.net

我在c#中有一个Web服务,并且在c#中运行良好。以下是我使用的一种方法

[WebMethod(EnableSession = true)]
        public void abc(BllNew objNew)
        {
            new DAL.Entity.BllNew().sample();
        }

但我再次在vb中实现了上述方法,就像这样

[WebMethod(EnableSession = true)]
        public void abc(BllNew objNew)
        {
            new DAL.Entity.BllNew().sample();
        }

一个语法错误显示在'new'关键字附近。我想要摆脱语法错误。请帮忙。

2 个答案:

答案 0 :(得分:2)

好吧,我没有你的所有图书馆,但我认为这是对的:

<WebMethod(EnableSession:=True)> _
Public Sub abc(ByVal objNew As BllNew)
    dim d as New DAL.Entity.BllNew().sample()
End Sub

答案 1 :(得分:1)

试试这个:

<WebMethod(EnableSession := True)> _
Public Sub abc(objNew As BllNew)
    New DAL.Entity.BllNew().sample()
End Sub