K
K
kmx2014-10-01 00:26:23
Microsoft
kmx, 2014-10-01 00:26:23

How to declare a string named operator in C#?

Actually the question is in the title. Is it possible to use the word operator to name a string?
If so, how to get around what VS swears?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Nikitin, 2014-10-01
@kmx

Using keywords in identifier names is not allowed, but in C# it is possible to use the @ prefix before the name. When compiled, @operator will become operator . But in general, I don’t advise doing this, it’s better to give the variable a different name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question