Reputation: 77
I was studying for my test today and I came accross the sentence
System.Console.WriteLine()
;
Could some one tell me what the System stands for cause when I remove it i dont see any diffrence.
Upvotes: 1
Views: 76
Reputation: 5008
Just the namespace where Console.WriteLine()
resides
which is a default import (using system
)
Upvotes: 1
Reputation: 11
The System in System.Console.WriteLine() refers to the System namespace. Therefore, if you're importing System in your code, it's redundant to call the WriteLine method using that namespace.
http://msdn.microsoft.com/en-us/library/System(v=vs.110).aspx
Upvotes: 1
Reputation: 648
System refers to the main library that contains the fundamental classes that define commonly-used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions. And Console type is one of them. the reason why you are not getting a difference is that it's referenced by default in the top of your class page
Upvotes: 1
Reputation: 77304
The System is the name of the namespace the class Console resides in. You need to give the full name or it won't compile. With one exception: if you have a line using System;
on top of your file, whenever something cannot be found, a namespace of System
will be assumed for lookup.
Upvotes: 1
Reputation: 8231
System is a Namespace. You will find it in the head of your code.
using System;
If you remove using System;
, you will find Console.WriteLine(); can't be complied.
Upvotes: 1
Reputation: 1500873
System
is just the namespace which contains the Console
type.
You almost certainly have a using directive like this in your code:
using System;
That imports every type within the namespace, so you can refer to it by its simple name. Without that directive, you would see a difference - System.Console
would still work, but just Console
wouldn't, because the compiler wouldn't know which type you meant.
Upvotes: 4