Why does WCF sometimes add “Field” to end of generated proxy types?

前端 未结 5 2121
夕颜
夕颜 2021-02-04 05:11

Basically, I have a server-side type \"Foo\" with members X and Y. Whenever I use Visual Studio\'s \"Add Server Reference\" then I see the WSDL and the generated proxy both appe

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-04 05:45

    Typically, the generated proxy will have "XField" and "YField" as internal/protected/private fields, and expose the values through properties called "X" and "Y". There are options you can set when creating the proxy client to tweak that to your liking, I think.

    UPDATE: I don't seem to find any switches or options to control this behavior. It might depend on which serializer (DataContractSerializer vs. XmlSerializer) WCF uses for creating the client proxy.

    In the end, it's really more or less just an issue of coding style - functionally, it shouldn't make a difference.

    Marc

提交回复
热议问题