csharp display float with 2 decimal places

Code Example - csharp display float with 2 decimal places

                
                        myFloatVariable.ToString("0.00"); //2dp Number

myFloatVariable.ToString("n2"); // 2dp Number

myFloatVariable.ToString("c2"); // 2dp currency
                    
                
 

csharp double value with 2 decimal places

                        
                                inputValue = Math.Round(inputValue, 2);
                            
                        
 

format double to 2 decimal places in csharp

                        
                                priceLbl.Text = price.ToString("0.##");