Can a WCF service expose a const string variable RRS feed

  • Question

  • Hi Everybody,

    Basically I have the same question with below link posted by other people.


    But seems they have no better solution, so i want to know is there any update?

    Or Microsoft do not support user to do this?


    Tuesday, January 22, 2013 1:31 AM


  • Similar question I want to raise.

    If it's really a constant, you should define it directly at client side because a constant can only be defined at compile time, but a binding WCF service can change from time to time.

    Marking it readonly (similar to const but allow setting value at constructor, so more appropiate for WCF proxy classes) won't help either because you're creating new instance each time you're using it. Still making it function like normal DataMember.

    What's more, WSDL does not define way to mark something constant, Microsoft can't do something out of thin air and declare it as conforming to a W3C standard, or other languages like Java will break when try to access WCF. You should probably complain to W3C instead if you think this feature should really exist (which I don't).

    • Edited by cheong00 Tuesday, January 22, 2013 6:24 AM
    • Marked as answer by Razer518 Wednesday, January 23, 2013 12:52 AM
    Tuesday, January 22, 2013 3:11 AM