ReadLine():
♣ ReadLine is a predefined member method od console class.
♣ This method will accept input from the user until user will press “Enter” key and that accepted value we will written as string because ReadLine method return type is String
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace program2
{
class Program
{
static void Main(string[] args)
{
/* to accept name */
Console.WriteLine("Enter Your Name");
string name = Console.ReadLine();
Console.WriteLine("your name is " + name);
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace program2
{
class Program
{
static void Main(string[] args)
{
/* to accept name */
Console.WriteLine("Enter Your Name");
string name = Console.ReadLine();
Console.WriteLine("your name is " + name);
Console.ReadLine();
}
}
}