Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Console.ReadLine() Method in C#
The Console.ReadLine() method in C# is used to read the next line of characters from the standard input stream.
Syntax
The syntax is as follows −
public static string ReadLine ();
Example
Let us now see an example to implement the Console.ReadLine() method in C# −
using System;
public class Demo{
public static void Main(){
string str;
Console.WriteLine("Enter any subject...");
str = Console.ReadLine();
Console.WriteLine("Entered subject = "+str);
}
}
Output
This will produce the following output −
Enter any subject... Entered subject = Maths
Advertisements