Buda Gavril Buda Gavril - 3 months ago 6
C# Question

why this code compiles (url is not a keyword)?

I have this code:

static void Main(string[] args)
{
Console.WriteLine("iexplore");
http://www.google.com;
Console.WriteLine("maximize");
Console.ReadLine();
}


It's not clear to me why this code compiles? Because I have an url there and it's not a c# keyword...

Answer

In C# doing

someText: 

makes a label for a goto, after that the

//Some other text

is a comment so

http://www.google.com;

is the label http: followed by the comment //www.google.com;

Comments