I'm not even sure how should I frame this question so that you all get what actually I'm asking for.
I'm wondering how does the keywords work in programming languages, being specific, C#. In the below code:
using System;
namespace TestApplication
{
class Program
{
static void Main(string[] args)
{
string s = "Hello";
Console.WriteLine(a.ToString());
Console.ReadLine();
}
}
}
Here, Console
is a predefined class of System
namespace which lies in mscorlib.dll. So when the compiler/CLR meets the Console.WriteLine()
, it will invoke the static method WriteLine()
with appropriate overload.
So the definition of WriteLine
method and Console
class all are already written and kept in the System namespace of the mscorlib assembly.
But my question is when the complier/CLR meets with the keywords like using
,namespace
, class
,static
, what does it do? Where is it written that it must treat the word next to the class
keyword as a new type? Is it built in to the compiler/CLR? How does it work then?