This project has moved and is read-only. For the latest updates, please go here.

DefaultValue and Enum?

Dec 14, 2010 at 8:58 PM

How can I handle this? Here is an example of what I am trying to do"


public enum WindowToolbarPosition

[DefaultValue(typeof(WindowToolbarPosition), "Bottom")] 
[JsonProperty(PropertyName = "toolbarPosition", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Include)] 
public WindowToolbarPosition ToolbarPosition { get; set ; } 

When the object gets Serialized the default value is never "Bottom" it is always "Top" any thoughts?


Dec 19, 2010 at 12:38 AM

It is writing Top because the property's value is Top.

DefaultValueHandling doesn't do what you think it does.