`
mlzboy
  • 浏览: 703220 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

xml反串行化

XML 
阅读更多
  1using System;
  2using System.Collections.Generic;
  3using System.Text;
  4
  5using System.Xml.Serialization;
  6
  7namespace DBSchema2Doc
  8{
  9    [Serializable]
 10    [XmlRoot("Root")]
 11    public class Settings
 12    {
 13        public Settings()
 14        {
 15
 16        }

 17        private DefaultSettings m_DefaultSettings;
 18        private SavedSettings m_SavedSettings;
 19        [XmlElement("DefaultSettings")]
 20        public DefaultSettings DefaultSettings
 21        {
 22            get
 23            {
 24                return this.m_DefaultSettings;
 25            }

 26            set
 27            {
 28                this.m_DefaultSettings = value;
 29            }

 30        }

 31        [XmlElement("SavedSettings")]
 32        public SavedSettings SavedSettings
 33        {
 34            get
 35            {
 36                return this.m_SavedSettings;
 37            }

 38            set
 39            {
 40                this.m_SavedSettings = value;
 41            }

 42        }

 43        public override string ToString()
 44        {
 45            return this.m_DefaultSettings.ToString();
 46        }

 47    }

 48    [Serializable]
 49    public class DefaultSettings
 50    {
 51        public DefaultSettings()
 52        {
 53        }

 54        private DefaultSetting[] m_DefaultSetting;
 55        [XmlElement("DefaultSetting")]
 56        public DefaultSetting[] DefaultSetting
 57        {
 58            get
 59            {
 60                return this.m_DefaultSetting;
 61            }

 62            set
 63            {
 64                this.m_DefaultSetting = value;
 65            }

 66        }

 67        public override string ToString()
 68        {
 69            string temp = "";
 70            foreach (DefaultSetting ds in this.m_DefaultSetting)
 71            {
 72                temp += "\n" + ds.ToString();
 73            }

 74            return temp;
 75        }

 76
 77    }

 78    [Serializable]
 79    public class DefaultSetting
 80    {
 81        public DefaultSetting()
 82        {
 83
 84        }

 85        private string m_name;
 86        private string m_value;
 87        [XmlAttribute("name")]
 88        public string name
 89        {
 90            get
 91            {
 92                return this.m_name;
 93            }

 94            set
 95            {
 96                this.m_name = value;
 97            }

 98        }

 99        [XmlAttribute("value")]
100        public string value
101        {
102            get
103            {
104                return this.m_value;
105            }

106            set
107            {
108                this.m_value = value;
109            }

110        }

111        public override string ToString()
112        {
113            return string.Format("\n name={0} value={1}"this.m_name, this.m_value);
114        }

115
116    }

117    [Serializable]
118    public class SavedSettings
119    {
120        public SavedSettings()
121        {
122
123        }

124        private SavedSetting[] m_SavedSetting;
125        [XmlElement("SavedSetting")]
126        public SavedSetting[] SavedSetting
127        {
128            get
129            {
130                return this.m_SavedSetting;
131            }

132            set
133            {
134                this.m_SavedSetting = value;
135            }

136        }

137    }

138    [Serializable]
139    public class SavedSetting
140    {
141        public SavedSetting()
142        {
143
144        }

145        private string m_connstr;
146        private string m_DBType;
147        private string m_name;
148        [XmlAttribute("connstr")]
149        public string connstr
150        {
151            get
152            {
153                return this.m_connstr;
154            }

155            set
156            {
157                this.m_connstr = value;
158            }

159        }

160        [XmlAttribute("DBType")]
161        public string DBType
162        border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics