Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Overloaded Methods
Message
General information
Forum:
ASP.NET
Category:
Web Services
Miscellaneous
Thread ID:
00691767
Message ID:
00692279
Views:
17
I agree that to the user of the WebMethod, it doesn't appear to be overloaded but internally to the application it is. So if you make a call to the method within your .NET app then you would call the overloaded method by the method name not the attribute name. So in that case the method is overloaded.

This "methodname" attribute is available for VB.NET and C#. You normally never use it unless you want to assign a different name to be used as a web method verses internally to your app or if you want to overload the method.

>Hi Cathi,
>
>Hmmmm ... ok, if you say so. <g>
>
>But because you still have to call the WebService method with a different name, it doesn't seem overloaded to the user of the WebService.
>
>Also, I haven't defined WebMethods like this (re assigning the methodname). Is this a VB thing or is this syntax the same in C#? The way I've done it, the name of the WebMethod is the same as the name of the class method, like this:
>
>
>[WebMethod(Description="This calls Foo")]
>public string Foo()
>{}
>
>
>~~Bonnie
>
>
>>Hi Bonnie,
>>
>>You can overload a WebMethod but you have to use unique names for the methodname attribute.
>>
>>
>><webmethod(methodname:="foo")> _
>>public function Foo() As String
>>end function
>>
>>
>><webmethod(methodname:="foo1")> _
>>public function Foo(ByVal x As Int) As String
>>end function
>>
>>
>>
>>>Claudio,
>>>
>>>I haven't actually tried to do it, but I've been told that you can't have overloaded methods in a Web Service.
>>>
>>>~~Bonnie
>>>
>>>>Hi, everybody!
>>>>
>>>>I have a class with an overloaded method, and this method is a WebMethod. I´m already using the MessageName attribute for the WebMethod. Is there something more that I need to know?
>>>>
>>>>I´m having some problem here, but I still didn´t know whether the problem is with the overloaded method or with my code.
>>>>
>>>>Any ideas on this?
>>>>
>>>>TIA
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform