Example #1
0
 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 + "]");
     }
 }
Example #2
0
 public static string Format(string format, params Object[] args)
 {
     ArgumentValidation.CheckForEmptyString(format, "format");
     try {
         return(string.Format(format, args));
     }
     catch {
         return(format);
     }
 }
Example #3
0
        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);
            }
        }