[Serializable]
public class ListGroups
{
public ListGroups()
{
this.MyList = new List<string>();
}
[XmlAttribute("mylist"), DefaultValue(typeof(List<string>), "")]
public List<string> MyList { get; set; }
[XmlAttribute("mybool"), DefaultValue(false)]
public bool MyBool { get; set; }
}
MyBool - all OK.
how write DefaultValue for List MyList, if "DefaultValue(null)" must not write - this.MyList = new List(); create Empty List.
i write - DefaultValue(new List() {}] - dont work.
what to do? I have hide XmlAttribute on XML if List MyList is Empty.