在回答你的第一个问题:
我通常喜欢使用的ConfigurationManager中的方法之一是这样一个:
http://msdn.microsoft.com/en-us/library/ms224437.aspx
或者有旧风格的XML使用XPath:
XmlDocument webConfig = new XmlDocument();
webConfig.Load(dllConfigFileName);
XmlNode someNode = webConfig.SelectSingleNode("//configuration/appSettings/add[@key='someKey']");
或更新的LINQ to XML:
XDocument document = XDocument.Load(configFileFullName);
XElement configurationElement = document.Element("configuration");
XElement appSettingsElement = configurationElement.Element("appSettings");
List<XElement> configSettings = new List<XElement>(appSettingsElement.Descendants("add"));
是不是可以使用配置文件? – chobo 2012-07-11 18:31:38