public static MonitoringConfig Load(XmlReader reader) { MonitoringConfig result = new MonitoringConfig(); reader.GoToElement(); reader.ReadStartElement(); if (!reader.IsEmptyElement) { while (reader.GoToSibling()) { switch (reader.LocalName) { case "Diagnostics": result.DiagnosticsConfig = DiagnosticsConfig.Load(reader); break; case "Logging": result.LoggingConfig = LoggingConfig.Load(reader); break; case "AdditionalData": string kvps = reader.ReadElementContentAsString(); foreach (var item in kvps.Split(',')) { var kvp = item.Split('='); result.AdditionalData.Add(kvp[0], kvp[1]); } break; default: reader.Skip(); break; } } } return(result); }