ReadLine Function & Place Holder

ReadLine Function & Place Holder
Rating: 5 - 1 Votes

ReadLine Function & Place Holder

C#This tutorial will demonstrate the use of ReadLine Function, which resides in Console class.  This function will help you in reading any string, which you will type in the console window.   The sample code for the ReadLine function is given below.

In the above code, with the help of WriteLine function, we will ask the user his first name as well as last name.   Both the names will be stored in 2 string variables, FirstName and LastName respectively.   To join both the names and display on the screen, we will make use of place holder.  The place holder is basically represented by two curly braces and one numerical value in between them.   In the above code, {0} will hold the value of FirstName and {1} will hold the value of LastName.