I would like to read lines from console until EOF. I came up with this solution but I don't know if it is correct one.
String line;
while ((line = Console.ReadLine()) != null) {
}
Console.ReadLine Method () returns :
The next line of characters from the input stream, or null if no more lines are available.
Question : I came up with this solution but I don't know if it is correct one!
Answer : Yes, your code is correct.
Also, please go through the added link in the answer to know more about its uses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With