0

I was browsing sources for microsoft .netcore runtime and came across these lines of code enter image description here

as you can see they are using @ symbol infront of every error message getter like @Error_InvalidFilePath.

My question is, what is this language feature that is being used here?
And, Where can I read more about it?

Thanks

Dmitry Matveev
  • 5,320
  • 1
  • 32
  • 43
  • 2
    They are called [verbatim identifiers](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/verbatim) and there is an entire section on them in the C# specification. – Dour High Arch May 23 '21 at 02:03
  • @DourHighArch thank you. you should post this in a reply so that I can accept it as an answer – Dmitry Matveev May 23 '21 at 02:04

1 Answers1

1

The @ is a way to use reserved words as names. E.g. the variable class could be used as variable name like @class.

For non reserved names this won't add anything. But of course you don't know which names are reserved in the future. Your code example is generated code, which should preferably work for newer language versions and so the @ makes sense there.

See docs

Julian
  • 33,915
  • 22
  • 119
  • 174