Array Class Collections File Keyword String .NET ASP.NET Cast Compression Data Delegate Directive Enum Exception If Interface LINQ Loop Method Number Process Property Regex Sort StringBuilder Struct Switch Time Windows WPF
Keywords. To convey meaning,
a language has grammar,
and words. A programming language too has words: these are keywords. Along with syntax, we use keywords to create meaning.
A list. Each keyword is listed in alphabetical order. These are only the reserved keywords. The list was taken from the C# Programming Language Specification third edition.abstractasbaseboolbreakbytecasecatchcharcheckedclassconstcontinuedecimaldefaultdelegatedodoubleelseenumeventexplicitexternfalsefinallyfixedfloatforforeachgotoifimplicitinintinterfaceinternalislocklongnamespacenewnullobjectoperatoroutoverrideparamsprivateprotectedpublicreadonlyrefreturnsbytesealedshortsizeofstackallocstaticstringstructswitchthisthrowtruetrytypeofuintulonguncheckedunsafeushortusingvirtualvoidvolatilewhile
Reserved keywords cannot be used as variable identifiers or member names. They are part of the language grammar that is used to parse programs. They are at the language's core.
Contextual. Some keywords are only considered keywords when used in certain contexts (query expressions). Contextual keywords are still usable as identifiers, unlike reserved keywords.Contextual
Accessibility. Programs become fantastically complex creatures. The principle of information hiding allows us to prevent certain parts of a program from accessing other parts.
Accessibility is specified with a modifier on a class member. These keywords also can be used with static members.
and usually the best,
accessibility is private.
Information hiding can make a program of unmanageable complexity manageable. It introduces synthetic barriers. This reduces the possibility of spaghetti code and needlessly involved logic.Spaghetti Code
Tokens. Programs are not compiled in a single step. They are first converted into tokens. We explore the concept of tokens. They are understood at the lexical level.Token
Many languages have common keywords. Often we find the first language we learn is hardest. We use a for-loop in C++ the same as in C# or Java. Some keywords (unsafe) are language-specific.
Languages have quirks. An if-statement in C# has slight differences to one in C++. This keeps things interesting.
is most important in development.
Keywords are essential to understanding the C# language. On the surface, they seem to be the entire language. But the intricate interactions between them is a greater part.