test

public class FilterItem : ObservableObject { [XmlAttribute("Key")] public string Key { get; set; } [XmlAttribute("Value")] public string Value { get; set; } private bool isChecked; [XmlAttribute("IsChecked")] public bool IsChecked { get { return isChecked; } set { if (isChecked != value) { isChecked = value; RaisePropertyChanged("IsChecked"); } } } } public class Filters { [XmlElement("FilterItems")] public List FilterItems { get; set; } [XmlElement("FilterType")] public FilterType FilterType { get; set; } } public enum FilterType { Desk, Sector, Seniority } public class FiltersList { [XmlElement("Filters")] public List ItemsSource { get; set; } public string ToXml() { var xs = new XmlSerializer(ItemsSource.GetType()); var xml = new StringWriter(); xs.Serialize(xml, ItemsSource); return xml.ToString(); } public List ToFiltersList(string xml) { var xs = new XmlSerializer(ItemsSource.GetType()); return (List)xs.Deserialize(new StringReader(xml)); } }
posted @ 2015-11-10 22:59  小胖搞IT  阅读(126)  评论(0编辑  收藏  举报