|
|
|
|
|
by beagle3
4050 days ago
|
|
On phone, can't copy/paste. But e.g. Enum Direction { East, West, North, South }; Put that as a field in a structure that's sent/received through WCF; on JSON it will encode as numbers, regardless on any annotation you put. On XML iirc too - though I don't remember for sure. Want them as strings? You have to encode/decode yourself. But if you use .NET on both sides , you wouldn't notice unless you sniff the connection - until you change the enumeration order, for example, and all help breaks loose. Which is to be expected of a binary protocol, but completely unexpected for verbose text formats like JSON or XML. |
|
It serializes correctly.
For JSON you need an appropriate converter but as I said I would not use WCF with JSON.