In VB.NET, you can surround a variable name with brackets and use keywords as variable names, like this:
Dim [goto] As String = ""
Is there a C# equivlent to doing this?
In VB.NET, you can surround a variable name with brackets and use keywords as variable names, like this:
Dim [goto] As String = ""
Is there a C# equivlent to doing this?
Prefix your variable with the @ sign
string @class = "fred";
The @ sign can also be used to prefix a non-escaped string literal:
string a = "fred\"; \\ invalid
string b = @"fred\"; \\ valid. the backslash is part of the literal 'fred\'
I use the latter from time to time butthink the using an @ sign to name variables is ugly.