C# Keywords

Array Collections File Keyword String .NET Cast Class Data Dictionary Enum Exception If Interface Lambda LINQ List Loop Method Number Process Property Regex Sort Split StringBuilder Struct Substring Switch Time Windows

Keyword: keywords direct program behavior

Keywords. We speak in words. We think in words. A programming language has keywords that have special meaning. Along with syntax, we use keywords to create meaning.


C# keywords. Some keywords (for, if and return) are reserved. This means they are used only in one way. And others (like using) have multiple meanings.

Key: used to access value

Reserved. These keywords cannot be used as variable identifiers or member names. They are part of the language grammar that is used to parse programs.

LINQ: keywords

Contextual. Some keywords are only special in some places (like query expressions). Contextual keywords are still usable as identifiers, unlike reserved ones.

Private keyword

Accessibility. Programs become fantastically complex creatures. In information hiding, we prevent certain parts of a program from accessing other parts.

publicprotectedinternalprotected internalprivate
Maze, contains complexity

Directives. These can turn a program into an incomprehensible mess, a tangle of logic. But #define and #if and #region often have utility in complex programs.


Tokens. Programs are not compiled in a single step. They are first converted into tokens. We explore the concept of tokens. We understand them at the lexical level.


Rare things. Some keywords are more important than others. A foreach loop is used more often than an unsafe code block. But even rare things improve our understanding.