读取XML
public sealed class ConfigManger { public XDocument XmlDocs { set; get; } string path = @"{0}\Configuration\Server\{1}"; public ConfigManger() { LoadFiles(); } public static ConfigManger Instance { get { return ConfigCreateXML.Singleton; } } public class ConfigCreateXML { static ConfigCreateXML() { } internal static readonly ConfigManger Singleton = new ConfigManger(); } void LoadFiles() { string filePath = string.Format(path, AppDomain.CurrentDomain.BaseDirectory, "ServerPath.config"); if (XmlDocs == null) { XmlDocs = XDocument.Load(filePath); } } }