C# Custom Number Formatting
Very often the inbuilt numerical formatting in C# will be insufficent and you will want to apply the custom formatting for your numbers.The String.Format method is very flexible and can be used to apply custom formatting rules. The # character informs the Format method how to format the numerical value, for example to forma the number 12000.12 as 12,000.12 use can use the format “#,#.##” as in the below code:double dbl1 = 12000.12;string outputStr;outputStr = string.Format(“This is a custom formatting example {0:#,#.##} “, dbl1);Response.Write(outputStr);In this example the , character is used to denote the thousand separator and the ## [...] Continue Reading…