You can pass the format in to the ToString
method, e.g.:
myFloatVariable.ToString("0.00"); //2dp Number
myFloatVariable.ToString("n2"); // 2dp Number
myFloatVariable.ToString("c2"); // 2dp currency
More Related Contents:
- When should I use double instead of decimal?
- How To Represent 0.1 In Floating Point Arithmetic And Decimal
- How to convert a Decimal to a Double in C#?
- How to convert Decimal to Double in C#?
- What’s the use/meaning of the @ character in variable names in C#?
- Double to string conversion without scientific notation
- What does the @ symbol before a variable name mean in C#? [duplicate]
- Decimal precision and scale in EF Code First
- Coercing floating-point to be deterministic in .NET?
- Formatting doubles for output in C#
- Is it safe to check floating point values for equality to 0?
- C++ decimal data types
- Compare floats in Unity
- Best way to display decimal without trailing zeroes
- How deterministic is floating point inaccuracy?
- C#: Convert Byte array into a float
- Float/double precision in debug/release modes
- Generating a Random Decimal in C#
- Best way to parse float?
- String to decimal conversion: dot separation instead of comma
- Conversion of a decimal to double number in C# results in a difference
- Performing Math operations on decimal datatype in C#?
- Should you access a variable within the same class via a Property?
- Why c# decimals can’t be initialized without the M suffix?
- Round a decimal to the nearest quarter in C#
- Why am I getting a compile error when multiplying a decimal by a literal value?
- How to round decimal value up to nearest 0.05 value?
- What’s the best way to represent System.Decimal in Protocol Buffers?
- How to get floats value without including exponential notation
- Double vs Decimal Rounding in C#