System.Web.Services.WebMethod( Description:= ...)

Discussion in 'ASP .Net' started by Mark B, May 7, 2009.

  1. Mark B

    Mark B Guest

    How can I set the Description below using a variable or a function rather
    than hard-coding text (I have another function that returns the Description
    text based on the user's language)?

    ' Visual Basic
    Public Class Service1
    Inherits System.Web.Services.WebService
    <System.Web.Services.WebMethod( _
    Description:="This method converts a temperature " & _
    "in degrees Fahrenheit to a temperature in degrees Celsius.")> _
    Public Function ConvertTemperature(ByVal dFahrenheit As Double) _
    As Double
    ConvertTemperature = ((dFahrenheit - 32) * 5) / 9
    End Function
    End Class
     
    Mark B, May 7, 2009
    #1
    1. Advertising

  2. Mark B

    Mr. Arnold Guest

    "Mark B" <> wrote in message
    news:...
    > How can I set the Description below using a variable or a function rather
    > than hard-coding text (I have another function that returns the
    > Description text based on the user's language)?
    >


    Private ReadOnly varname As String = "Help"


    > ' Visual Basic
    > Public Class Service1
    > Inherits System.Web.Services.WebService
    > <System.Web.Services.WebMethod(Description:= &varname)> _
    > Public Function ConvertTemperature(ByVal dFahrenheit As Double) _
    > As Double
    > ConvertTemperature = ((dFahrenheit - 32) * 5) / 9
    > End Function
    > End Class


    I don't know if that's what you're talking about or not. I don't know if
    "const" statement in VB either, but I kind of recall that you can use
    "const" in VB too like C#.


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4058 (20090507) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com
     
    Mr. Arnold, May 7, 2009
    #2
    1. Advertising

  3. Mark B

    Mark B Guest

    That doesn't work.

    The Description:= &varname is underlined with control-tip text saying:

    "Constant expression is required."

    "Mr. Arnold" <MR. > wrote in message
    news:...
    >
    > "Mark B" <> wrote in message
    > news:...
    >> How can I set the Description below using a variable or a function rather
    >> than hard-coding text (I have another function that returns the
    >> Description text based on the user's language)?
    >>

    >
    > Private ReadOnly varname As String = "Help"
    >
    >
    >> ' Visual Basic
    >> Public Class Service1
    >> Inherits System.Web.Services.WebService
    >> <System.Web.Services.WebMethod(Description:= &varname)> _
    >> Public Function ConvertTemperature(ByVal dFahrenheit As Double) _
    >> As Double
    >> ConvertTemperature = ((dFahrenheit - 32) * 5) / 9
    >> End Function
    >> End Class

    >
    > I don't know if that's what you're talking about or not. I don't know if
    > "const" statement in VB either, but I kind of recall that you can use
    > "const" in VB too like C#.
    >
    > __________ Information from ESET NOD32 Antivirus, version of virus
    > signature database 4058 (20090507) __________
    >
    > The message was checked by ESET NOD32 Antivirus.
    >
    > http://www.eset.com
    >
    >
    >
     
    Mark B, May 7, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rbt
    Replies:
    4
    Views:
    448
    Larry Bates
    Jan 31, 2005
  2. Lisa Ngo
    Replies:
    3
    Views:
    467
    Jan Tielens
    Jan 18, 2004
  3. Chris Bardon

    Parsing WSDL and System.Web.Services.Description

    Chris Bardon, May 17, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    191
    Chris Bardon
    May 17, 2004
  4. niama
    Replies:
    2
    Views:
    138
    niama
    Mar 9, 2005
  5. John
    Replies:
    4
    Views:
    470
Loading...

Share This Page