public static void Send(MailEntity entity, MailSendType type = MailSendType.Smtp) { MailWrapper wrapper; if (!s_Cache.TryGetValue(type, out wrapper)) { lock (s_SyncObj) { if (!s_Cache.TryGetValue(type, out wrapper)) { XmlNode section = ConfigurationManager.GetSection("mail") as XmlNode; wrapper = new MailWrapper(section, type); s_Cache.Add(type, wrapper); } } } wrapper.Send(entity); }