In C#, there are 79 keywords that are reserved and have a specific meaning in
the language. These keywords can be grouped into various categories, such as
access modifiers, control flow, data types, operators, and others.
Here is a list of all the C# keywords:
Access Modifiers
- public
- private
- protected
- internal
- protected
- internal
Control Flow
- if
- else
- switch
- case
- default
- while
- do
- for
- foreach
- break
- continue
- goto
- return
- throw
- try
- catch
- finally
Data Types
- bool
- byte
- char
- decimal
- double
- float
- int
- long
- sbyte
- short
- string
- uint
- ulong
- ushort
- void
Modifiers
- abstract
- async
- const
- event
- extern
- new
- override
- readonly
- sealed
- static
- unsafe
- virtual
- volatile
Operators
- as
- is
- sizeof
- typeof
Contextual
- add
- dynamic
- get
- global
- partial
- remove
- set
- value
- var
- where
- yield
Each of these keywords has a specific meaning in C# and is used in various
parts of the language. For example, access modifiers are used to specify the
accessibility of a class, method, or field. Control flow keywords are used
to control the flow of execution in a program, such as loops and
conditionals. Data type keywords are used to define variables and parameters
with a specific data type, such as int or string.
As a C# programmer, it is important to have a good understanding of these
keywords and how they are used in the language. By using the appropriate
keywords in the right context, you can write clean, efficient, and
maintainable code.
In this tutorial, we have covered all the C# keywords. By mastering
these keywords, you will be well on your way to becoming a proficient C#
programmer.