0
System.Console.ReadLine() vs Console.ReadLine()
What is the difference between System.Console.ReadLine() and Console.ReadLine()??
3 Respuestas
+ 8
There is generally no difference between the two. In the system namespace, console is a static class.
Hence, if you did:
using System;
in your code, you don't have to specify the namespace again to call the console class. (But you can if you want to, honestly it wouldn't make any difference.)
Sometimes if 2 class have the same name, you would have to specify which namespace you are using.
and finally, ReadLine() is a method/function from the class Console of course!
+ 11
There's no difference. You call ReadLine() from the Console class, which is in the System namespace. Writing "using System" allows you to skip typing out the namespace every time.
+ 4
If u r "using System" namespace then no need to write System.Console.ReadLine.
Hope u got it.