how to get number of decimal places in c# code example
Example 1: c# display float with 2 decimal places
myFloatVariable.ToString("0.00"); //2dp Number
myFloatVariable.ToString("n2"); // 2dp Number
myFloatVariable.ToString("c2"); // 2dp currency
Example 2: Decimal Number Variable C#
float number = 8.1f;