CSharp examples for Language Basics:Data Type Format
Format Price Interpolated
using System;/*from w ww .ja va 2 s.c o m*/ using System.ComponentModel; public class FormatPriceInterpolated { static void Main() { decimal price = 95.25m; decimal tip = price * 0.2m; Console.WriteLine($"Price: {price,9:C}"); Console.WriteLine($"Tip: {tip,9:C}"); Console.WriteLine($"Total: {price + tip,9:C}"); } }