I have the following class and wish to use JsonProperty's DefaultValueHandling.IgnoreAndPopulate but I'm having problems at setting a List's default value. I tried the following code but there is an error during compilation. How can I set the list default value in this case?
I showed the my 3 tries, the default value in list2 compiles propely but doesn't work, the default value in list1 and list3 dont compile.
      public class MyClass
      {
            [DefaultValue("")]
            [JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
            public string String1 { get; set; }
            [DefaultValue(0)]
            [JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
            public double Double2 { get; set; }
            [DefaultValue(new List<string>())]
            [JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
            public List<string> list1 { get; set; }
            [DefaultValue(new string[] {})]
            [JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
            public List<string> list2 { get; set; }
            [DefaultValue(new List<string>())]
            [JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
            public List<string> list3 { get; set; }
     }
Error : An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type.