Console.WriteLine("{0:g}", DateTimeKind.Utc); // general Console.WriteLine("{0:f}", DateTimeKind.Utc); // string Console.WriteLine("{0:d}", DateTimeKind.Utc); // integer Console.WriteLine("{0:x}", DateTimeKind.Utc); // hex
Console.WriteLine("{0} {1} {2}",100,200,3000); Output: 100 200 3000
Console.WriteLine("{0:X} {1:N1} {2:#,#}",100,200,3000); Output: 64 200.0 3,000
Console.WriteLine("(amount):{0,30:C}", 1123.27); Output: (amount): £1,123.27 Console.WriteLine("{0,-30:C}(amount)", 1123.27); Output £1,123.27 (amount)
# #,# #.# 0 0,0 0.00
positive;negative
C £N £#,#
Console.WriteLine(Math.Round(2.5)); // Displays 2
2,354,856: 1 sf = 2,000,000 2 sf = 2,400,000 3 sf = 2,350,000