Click or drag to resize

StringHelperFormatPrecision Method

Formats the number to a specific precision.

Namespace:  Xcalibur.Helpers
Assembly:  Xcalibur.Helpers (in Xcalibur.Helpers.dll) Version: 1.0.1.0 (1.0.1.0)
Syntax
public static string FormatPrecision(
	this double number,
	int precision
)

Parameters

number
Type: SystemDouble
The number.
precision
Type: SystemInt32
The precision.

Return Value

Type: String

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Double. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
C#
 1static void Main(string[] args)
 2{
 3    var number = 12.23567875467;
 4    Console.WriteLine(number.FormatPrecision(2));
 5
 6    // Hold
 7    Console.Read();
 8}
 9
10// Result: 12.24
See Also