Alex Rivera | Logout

how to escape key words in c#?

Asked 2010-04-06T20:54:48.233
9

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# ?

Edit
Report

1 Answer

7

Use @ for reserved words:

@class=>"hello"
answered 2010-04-06T20:55:54.657

Your Answer