Strange construct in template code

When creating an a new ASP.NET Web Service project in VS2005 Beta 2, I am curious about the template generating the 'Public Sub Service' procedure within the genrated class (as demonstrated below).

Can anyone enlighten me as to what this procedure is designed for and what, if anything I should be doing with it


<WebService(Namespace:="http://tempuri.org/")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

Public Class Service

      Inherits System.Web.Services.WebService

      Public Sub Service()

      End Sub

      <WebMethod()> _

      Public Function HelloWorld() As String

         Return "Hello World"

      End Function

End Class


 



Answer this question

Strange construct in template code

  • Xin Yan MSFT

    Thanks Todd.

    Thta was my initial suspicion, however I can find no information about such a change.

    The procedure is question is never executed wheras a Sub New() is executed as expected.

    I deleted the procedure and all works quite happily so I'm assuming that it was some abberation of one of the coders that hasn't yet been spotted.

  • Oliver Slay

    Hello Stephany,

    I haven't had time to play with 2.0 betas yet but it looks to me like the constructor method, similar to how C# looks. So if you want to have any intialization code execute when this Service class is created, maybe you would add that to the Service() method.

    Does VB.NET 2.0 still use New() for constructor methods or ClassName()

    -Todd

  • christopher.stevens

    Glad your up and running. Appears to be a bug in the framework, or Web Service web site solution template. This should be corrected by the RTM version.

    Thanks
    -Todd



  • Strange construct in template code