I have a .Net Web Service function that can take one line.
This function then serializes this string into JSON, but I want to serialize it if the value is not equal.
I found the following instructions:
http://msdn.microsoft.com/en-us/library/aa347792.aspx
[DataContract] public class MyClass { [DataMember (EmitDefaultValue=false)] public string myValue = "" }
Unfortunately, I cannot hide myValue from serialization, because "" is not the default .Net value for the string (as it is!)
One of two options:
I would prefer the first, because it makes the code cleaner, but the opinion will be great.
thanks
source share