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

  • Thread starter Thread starter Mark B
  • Start date Start date
M

Mark B

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 said:
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
 
That doesn't work.

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

"Constant expression is required."
 
Back
Top