[DataContract]
class MyClass
{
[DataMember(EmitDefaultValue = false)]
public bool Value { get; set; }
public MyClass()
{
Value = true;
}
}
static void Main(string[] args)
{
Console.WriteLine(JsonConvert.DeserializeObject<MyClass>("{\"Value\": false}").Value);
Console.ReadKey();
}
It will print 'True'. I think this is a bug, because I can't figure out where this scenario is valid, but how to set default value in DataMember otherwise?