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?
string @string = "";
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 but think the using an @
sign to name variables is ugly.
With a @
public IActionResult Submit(Guid? id, string type, string key, string @event)
{
}