Keywords

In our little example, we’ve already seen various keywords. Keywords source code character sequences reserved by the language for some special meaning, and therefore they cannot be used as identifiers in the user’s code.

So far, the keywords we’ve seen are class, foreach, in, int, return, static, string, using, and void. At the time of this writing, C# has 78 reserved keywords. This sounds like an incredibly large number, but by the end of this chapter you’ll already have seen about half of them.

Note: @

Under rare circumstances, the use of a keyword as an identifier is desirable. A few years ago, I was involved in the development of some school administration software. Information about students, courses, and classes had to be fetched ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.