define ReadLine method ?
define ReadLine method ?
ReadLIne(): -
This method comes under the class “Console”. In C# this method reads the next line characters from the standard input stream.
Below is the C# program to implement the ReadLine() method: -
//using the namespace System
using System;
//Defining the main class
public class Example
{
//Defining the main method
public static void Main()
{
//Declaring the variable to store the string
string s;
//Prompts the user to enter your name
Console.WriteLine("Please enter your name.");
//ReadLine method is used read the next line characters
s = Console.ReadLine();
//Displaying the name
Console.WriteLine("Entered name is: "+s);
}
}
Step by step
Solved in 3 steps with 1 images