What Are Keywords in C#?
C# is rich in features and keywords, which help in making the language strong and versatile. Keywords are reserved words with special meaning that is known to the compiler. These keywords also have special significance and hence cannot be used as identifier names for variable-name, class-name, or interface-name. In this chapter, you will get to know more about C# keywords.
C# Keywords and Its Type
Keywords are reserved words having special meaning whose meaning is already defined to the compiler. The keywords in C# are categorized under various groups. These are:
Type | Keywords |
---|---|
Modifier Keywords | abstract, async, const, event, extern, new, override, partial, readonly, sealed, static, unsafe, virtual, volatile |
Access Modifier Keywords | public, private, protected, internal |
Statement Keywords | if, else, switch, case, do, for, foreach, in, while, break, continue, default, goto, return, yield, throw, try, catch, finally, checked, unchecked, fixed, lock |
Method Parameter Keyword | params, ref, out |
Access Keywords | base, this |
Namespace Keywords | using, . operator, :: operator, extern alias |
Literal Keywords | null, false, true, value, void |
Operator Keywords | as, await, is, new, sizeof, typeof, stackalloc, checked, unchecked |
Contextual Keywords | add, var, dynamic, global, set, value |
Type Keywords | bool, byte, char, class, decimal, double, enum, float, int, long, sbyte, short, string, struct, uint, ulong, ushort |
Query Keywords | from, where, select, group, into, orderby, join, let, in, on, equals, by, ascending, descending |