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)
Syntaxpublic static string FormatPrecision(
this double number,
int precision
)
<ExtensionAttribute>
Public Shared Function FormatPrecision (
number As Double,
precision As Integer
) As String
public:
[ExtensionAttribute]
static String^ FormatPrecision(
double number,
int precision
)
[<ExtensionAttribute>]
static member FormatPrecision :
number : float *
precision : int -> string
Parameters
- number
- Type: SystemDouble
The number. - precision
- Type: SystemInt32
The precision.
Return Value
Type:
StringUsage 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 1static void Main(string[] args)
2{
3 var number = 12.23567875467;
4 Console.WriteLine(number.FormatPrecision(2));
5
6
7 Console.Read();
8}
9
10
See Also