C# Language Keywords

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Keywords are predefined, reserved identifiers with special meaning to the compiler. They cannot be used as identifiers in your program without the @ prefix. For example @if is a legal identifier but not the keyword if.

Remarks

C# has a predefined collection of "keywords" (or reserved words) which each have a special function. These words can not be used as identifiers (names for variables, methods, classes, etc.) unless prefixed with @.

Apart from these, C# also uses some keywords to provide specific meaning in code. They are called contextual keywords. Contextual keywords can be used as identifiers and doesn't need to be prefixed with @ when used as identifiers.



Got any C# Language Question?