public static string ErrorMessageFormatter(System.Variable variable, object o, Type typeExpected) { string typeName = "null"; if (o != null) { typeName = o.GetType().Name; } return(String.Format("[{0}] cannot have a value of {1} type. Please specify a value of {2} type.", variable, typeName, typeExpected.Name)); }
public static string ErrorMessageFormatter(System.Variable variable, object o, string minValueLowRange, string maxValueLowRange, string minValueHighRange, string maxValueHighRange) { string value = null; if (o is int) { value = Convert.ToString((int)o); } else if (o is double) { value = Convert.ToString((double)o); } return(String.Format("The specified value {0} for [{1}] must be within range from {2} to {3} or {4} to {5}.", value, variable, minValueLowRange, maxValueLowRange, minValueHighRange, maxValueHighRange)); }