decimal to string whole number c#
decimal x = 123.45M;
Console.WriteLine(x.ToString("0")); // Output: 123
Console.WriteLine(x.ToString("0.0")); // Output: 123.5 <- note there is rounding
Console.WriteLine(x.ToString("0.00")); // Output: 123.45
Console.WriteLine(x.ToString("0.000")); // Output: 123.450
Console.WriteLine(x.ToString("#.###")); // Output: 123.45
Also in C#:
- c# how to refreshyour bindingsource
- c# bitmap to Image
- play animation through script unity
- c# warning CS0108
- c# change variable types
- c# AllowSynchronousIO to true
- percentage in c#
- unity rotate around point
- unity transformer double en float
- c# tuple access
- unity to integer
- unity 3d mouse look script
- mysql executeScalar only if successful
- c# fileupload example
- singleton design pattern c# volatile
- c# counting lines
- generic repository pattern c#
- reload scene unity
- c# display float with 2 decimal places
- check if current time is in the morning c#
- isGrounded script for copy
- fahrenheit to celsius c#
- unity set material color
- c# transform