I want to do the equivalent of the following VB in c#
Function([class]) "hello"
This would be the same as this in c#
class=>"hello"
The problem is that the word class
is a key word in the language. But I want to use it as a variable name. In the VB example you can use the []
brackets to 'escape' that key word and allow it to be used as a variable name.
Is there a way to do this in C# ?
You need to add @
to variable names:
@class
But it is a very bad practice. Every time you name your variable as a keyword a kitten dies :)
Use @ for reserved words:
@class=>"hello"
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