public static MailerConfiguration GetSection(string fileName, string name) { System.Configuration.ConfigXmlDocument doc = new ConfigXmlDocument(); try { doc.Load(fileName); XmlNode node = doc.GetElementsByTagName(name)[0]; IConfigurationSectionHandler handler = new UniMail.ConfigurationHandler(); return(handler.Create(null, null, node) as UniMail.MailerConfiguration); } catch { return(null); } }
public static MailerConfiguration GetSection(string fileName, string name) { System.Configuration.ConfigXmlDocument doc = new ConfigXmlDocument(); try { doc.Load(fileName); XmlNode node = doc.GetElementsByTagName(name)[0]; IConfigurationSectionHandler handler = new UniMail.ConfigurationHandler(); return handler.Create(null, null, node) as UniMail.MailerConfiguration; } catch { return null; } }