Keywords in C Sharp
An editor has nominated this article for deletion. You are welcome to participate in the deletion discussion, which will decide whether or not to retain it. |
The keywords of the C# language determine its features. The language has two types of keyword — contextual and reserved. The reserved keywords such as false or byte may only be used as keywords. The contextual keywords such as where or from are only treated as keywords in certain situations.[1]
C# is case-sensitive and its keywords are always written in lower-case.[2]
If an identifier is needed which would be the same as a reserved keyword, it may be prefixed by the @ character to distinguish it. This facilitates reuse of .NET code written in other languages.[3]
Some frequently used keywords
finally out true byte fixed override try case
for private uint char foreach protected ulong checked goto public unchecked class if
float params typeof catch readonly unsafe const implicit ref ushort continue in return using decimal
sbyte virtual default interface sealed volatile delegate internal short void do is sizeof while double
operator throw break
int lock stackalloc
else long static
enum namespace string
event new struct as explicit null switch abstractbase extern object this bool false
References
- ^ Herbert Schildt, C# 3.0: The Complete Reference
- ^ Matthew MacDonald, Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional
- ^ Harvey M. Deitel, Paul J. Deitel, C# for programmers