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

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
 
M

Mr. Arnold

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
 
M

Mark B

That doesn't work.

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

"Constant expression is required."
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top