0

Now, I know what @ operator is for - it allows to use reserved word as variable name or make non-escaping string, but recently I've received codebase which contain this (names changed and parts of string as I'm under NDA):

somestring = @"This is good thing that @nametag is there";

Obviously it seems to be some kind of placeholder, but what it exactly does?

Dariusz G. Jagielski
  • 655
  • 3
  • 11
  • 22
  • 1
    It's nothing native to C# as far as I know. Probably a tokenized string for use by the codebase itself. – McGarnagle Oct 06 '13 at 19:01
  • 1
    By default, it’s just a character inside a string. But it could be used by something that processes the string and replaces the part with something else. Now we can’t tell you what in your code does that. – poke Oct 06 '13 at 19:02
  • 2
    Could you give a bit more context. This could mean anything, depending on your code. The language itself assigns no special meaning to an @ inside a string literal. – Mithrandir Oct 06 '13 at 19:04
  • http://stackoverflow.com/questions/91817/whats-the-use-meaning-of-the-character-in-variable-names-in-c – OldProgrammer Oct 06 '13 at 19:04

1 Answers1

3

Likely a placeholder to be replaced at runtime

For example:

Dear @CustomerName,

Join the first ever event in @City at @Time on @Date

...

Max
  • 1,150
  • 9
  • 13