CSharp examples for Language Basics:Data Type Format
Format Price Interpolated in Verbatim String
using System;/* ww w. j av a2s .c om*/ using System.ComponentModel; public class FormatPriceInterpolatedVerbatim { static void Main() { decimal price = 95.25m; decimal tip = price * 0.2m; Console.WriteLine($@"Price: {price,9:C} Tip: {tip,9:C} Total: {price + tip,9:C}"); } }