Return <bar>foo</bar> instead of <string>foo</string> in WCF rest method

Posted by Joannes Vermorel on Stack Overflow See other posts from Stack Overflow or by Joannes Vermorel
Published on 2010-04-24T07:37:32Z Indexed on 2010/04/24 7:43 UTC
Read the original article Hit count: 362

Filed under:
|
|
|

I have a REST web method in .NET 3.5:

[OperationContract]
[WebInvoke(UriTemplate = "", Method = Verbs.Get)]
public string GetBar()
{
   return "foo";
}

The response gets formatted as <string>foo</string> while I would prefer <bar>foo</bar> instead. Does anyone know how to do that? I feel I am missing something obvious.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wcf