DisplayDouble
Converts a Double to a String with precision
Source
public static string DisplayDouble(this double value, int precision)
{
return value.ToString("N" + precision);
}
Example
double number = 2.2365;
string display = number.DisplayDouble(2); // 2.24