The reason I ask is, it's only valid in method parameter declaration, isn't it? I was trying to make a variable inside the function body called "params", but of course this is not a big deal, just wondering the reason MS chose to make it a global keyword and not contextual.
The same could be asked about any other keyword. For example, why isn't "class" contextual since it's only used in class declarations?
To me a keyword is a keyword. I imagine it greatly simplifies the lexical analysis part of compilation to not have to be THAT context aware.
As an aside, you can use the @
symbol to allow you to declare a variable called 'params' (or any other reserved keyword):
var @params = new int[] { 1, 2 };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With