- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between Read(), ReadKey() and ReadLine() methods in C#?
Read()
The Read() reads the next characters from the standard input stream. If a key is pressed on the console, then it would close.
int az = Console.Read() Console.WriteLine(z);
ReadKey()
It reads only a single charactare from the standard input stream.
ReadLine()
Reads the next line of characters from the standard input stream.
Example
using System; class Program { static void Main() { int x = 10; Console.WriteLine(x); Console.Write("
Press any key to continue... "); Console.ReadLine(); } }
Output
10 Press any key to continue...
Advertisements