The 100 Keywords of C#

Previously I wrote about the The 10 Type Members of C#, and how it would be useful to list and understand each. In this article, I’ll take it a step further and refer to the identifiers and keywords of C# in the same context.

At the time of writing, According to MSDN, there are 77 Reserved Identifiers. These have a special meaning to the and cannot be used as a custom identifier unless they are prefixed with @. For completeness, they are:

abstract as base bool break byte case
catch char checked class const continue decimal
default delegate do double else enum event
explicit extern false finally fixed float for
foreach goto if implicit in int interface
internal is lock long namespace new null
object operator out override params private protected
public readonly ref return sbyte sealed short
sizeof stackalloc static string struct switch this
throw true try typeof uint ulong unchecked
unsafe ushort using virtual void volatile while

Some of these have different meaning depending on the context, for example:

  • using
  • in
  • out

MSDN also lists 23 Contextual Keywords. You can use these words as custom identifiers:

add alias ascending async await dynamic from
get global group into join let orderby
partial remove select set value var where
yield

Again, some of these have an overloaded usage, for example:

  • partial
  • where

In contrast to my suggestion in the aforementioned article 10 Type Members of C#, I wouldn’t suggest that you be able to list them all off the top of your head. However, from a study perspective, I think this list is a good checkpoint of one’s understanding of the C# core. Understanding each one, even if you rarely or never use it, is useful thing.

Leave a Reply