Can't use optional parameters when implementing an interface for a WCF

后端 未结 5 776
刺人心
刺人心 2021-01-11 10:19

In my interface I have declared this.

[OperationContract]
[WebGet]
String GetStuff(String beep, String boop = \"too lazy to type\");

I impl

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-11 10:43

    you should check out the code generated when adding the service reference.

    as the code is generated from WISDL, where the signature is (pseudo):

    GetStuff(String , String )
    

    it generates the code accordingly, not knowing about the optional parameters. so, if you want to get lazy, you should alter the proxy class generated or, as @Stephen Borg suggested, overload the function.

提交回复
热议问题