xml反串行化

  1 None.gif using  System;
  2 None.gif using  System.Collections.Generic;
  3 None.gif using  System.Text;
  4 None.gif
  5 None.gif using  System.Xml.Serialization;
  6 None.gif
  7 None.gif namespace  DBSchema2Doc
  8 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
  9InBlock.gif    [Serializable]
 10InBlock.gif    [XmlRoot("Root")]
 11InBlock.gif    public class Settings
 12ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 13InBlock.gif        public Settings()
 14ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 15InBlock.gif
 16ExpandedSubBlockEnd.gif        }

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

 26InBlock.gif            set
 27ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 28InBlock.gif                this.m_DefaultSettings = value;
 29ExpandedSubBlockEnd.gif            }

 30ExpandedSubBlockEnd.gif        }

 31InBlock.gif        [XmlElement("SavedSettings")]
 32InBlock.gif        public SavedSettings SavedSettings
 33ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 34InBlock.gif            get
 35ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 36InBlock.gif                return this.m_SavedSettings;
 37ExpandedSubBlockEnd.gif            }

 38InBlock.gif            set
 39ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 40InBlock.gif                this.m_SavedSettings = value;
 41ExpandedSubBlockEnd.gif            }

 42ExpandedSubBlockEnd.gif        }

 43InBlock.gif        public override string ToString()
 44ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 45InBlock.gif            return this.m_DefaultSettings.ToString();
 46ExpandedSubBlockEnd.gif        }

 47ExpandedSubBlockEnd.gif    }

 48InBlock.gif    [Serializable]
 49InBlock.gif    public class DefaultSettings
 50ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 51InBlock.gif        public DefaultSettings()
 52ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 53ExpandedSubBlockEnd.gif        }

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

 62InBlock.gif            set
 63ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 64InBlock.gif                this.m_DefaultSetting = value;
 65ExpandedSubBlockEnd.gif            }

 66ExpandedSubBlockEnd.gif        }

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

 74InBlock.gif            return temp;
 75ExpandedSubBlockEnd.gif        }

 76InBlock.gif
 77ExpandedSubBlockEnd.gif    }

 78InBlock.gif    [Serializable]
 79InBlock.gif    public class DefaultSetting
 80ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 81InBlock.gif        public DefaultSetting()
 82ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 83InBlock.gif
 84ExpandedSubBlockEnd.gif        }

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

 94InBlock.gif            set
 95ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 96InBlock.gif                this.m_name = value;
 97ExpandedSubBlockEnd.gif            }

 98ExpandedSubBlockEnd.gif        }

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

106InBlock.gif            set
107ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
108InBlock.gif                this.m_value = value;
109ExpandedSubBlockEnd.gif            }

110ExpandedSubBlockEnd.gif        }

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

115InBlock.gif
116ExpandedSubBlockEnd.gif    }

117InBlock.gif    [Serializable]
118InBlock.gif    public class SavedSettings
119ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
120InBlock.gif        public SavedSettings()
121ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
122InBlock.gif
123ExpandedSubBlockEnd.gif        }

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

132InBlock.gif            set
133ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
134InBlock.gif                this.m_SavedSetting = value;
135ExpandedSubBlockEnd.gif            }

136ExpandedSubBlockEnd.gif        }

137ExpandedSubBlockEnd.gif    }

138InBlock.gif    [Serializable]
139InBlock.gif    public class SavedSetting
140ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
141InBlock.gif        public SavedSetting()
142ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
143InBlock.gif
144ExpandedSubBlockEnd.gif        }

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

155InBlock.gif            set
156ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
157InBlock.gif                this.m_connstr = value;
158ExpandedSubBlockEnd.gif            }

159ExpandedSubBlockEnd.gif        }

160InBlock.gif        [XmlAttribute("DBType")]
161InBlock.gif        public string DBType
162ExpandedSubBlockStart.gifContractedSubBlock.gif        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值