Why method overloading is not allowed in WCF?

前端 未结 3 1541
栀梦
栀梦 2020-11-29 00:42

Assume that this is a ServiceContract

[ServiceContract]
public interface MyService
{
    [OperationContract]
    int Sum(int x, int y);

    [O         


        
3条回答
  •  鱼传尺愫
    2020-11-29 01:12

    Because when invoking over HTTP/SOAP, having the same method name in your contract would mean that there's no way to determine which particular method the client is about to invoke.

    Remember that when invoking web methods over http, arguments are optional and are initialized with default values if missing. This means that invocation of both methods could look exactly the same way over HTTP/SOAP.

提交回复
热议问题