public static string FormatStr(double value, DecimalPlace decimalPlace) { string ret = null; switch (decimalPlace) { case DecimalPlace.N2: case DecimalPlace.N3: ret = value.ToString(decimalPlace.ToString()); break; default: ret = value.ToString(); break; } return(ret); }