How to use string interpolation to format string in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 31;

            Console.WriteLine($"Your age is: {n}");
        }
        
    }
}


/*
run:
     
Your age is: 31

*/

 



answered Dec 24, 2016 by avibootz
edited Dec 24, 2016 by avibootz
...