myclass is working as string as well as myClass in below example.
I know everyone will say this is not a good habit to use something like in below example.
CODE:
class myClass
{
public static void Main(string[] args)
{
string @myClass = "my-Class";
myClass.Replace("-", " "); //myClass works as string
myClass ob = new myClass(); //myClass works as myClass
ob.i();
}
public void i()
{
}
}
But I want to know:
- Is this a compiler bug? as compiler should give warning.
- How compiler manages this dual nature?