public static string FormatNotify(string format, params Object[] args) { ArgumentValidation.CheckForEmptyString(format, "format"); try { return(string.Format(format, args)); } catch (Exception e) { return(format + " [" + e.Message + "]"); } }
public static string Format(string format, params Object[] args) { ArgumentValidation.CheckForEmptyString(format, "format"); try { return(string.Format(format, args)); } catch { return(format); } }
public static string AppSettingsString(string name, bool required, string defaultValue) { ArgumentValidation.CheckForEmptyString(name, "config item name"); string configValue = ConfigurationManager.AppSettings[name]; configValue = (null == configValue ? string.Empty : configValue.Trim()); if (string.Empty == configValue) { if (!required) { return(defaultValue); } throw new Exception(SafeFormatter.Format(ELEMENT_NOT_FOUND, name)); } else { return(configValue); } }