tutorial - oops concepts in c# with examples codeproject




Can web methods be overloaded? (3)

No. Web Service method names must be unique.

I have built a regular .NET asmx service. How do i overload web methods in this service?


WS-I (web services interoperability) does not support overloading.


You can't really overload a web method. When you think about it, this makes sense because a web method is designed not to rely on underlying technologies such as OO languages, as it can theoretically run in things like COBOL.

While you can write a web method that looks like it can be overloaded, you actually have to assign it a different name, as in:

[WebMethod]
public void Add(int x, int y)
{
}
[WebMethod(MessageName="AddFloat")]
public void Add(float x, float y)
{
}




oop