Contextual Keywords

A language with too many reserved keywords can definitely be annoying to developers because of the need to escape keywords all over the place. Especially because keywords are usually based on the English language, clashes with identifiers are a very real risk. Imagine what would happen if value were a reserved keyword:

int @value = discount.Value;

As a matter of fact, value has a reserved meaning in C#, but only in certain contexts. This combines the best of both worlds, using natural-sounding English words to represent programming language features while leaving the word available for use as an identifier in certain contexts. You can refer to those identifiers with occasional special meaning as contextual keywords, although ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.