C#, just like other languages, contains reserved words. These words are called keywords. Keywords have meaning to the compiler and cannot be used as variable, class, or any other object in the program.

Keywords in C# are categories as the following:

  • Modifier keywords: Modifier keywords are keywords that can modify type and type members. They allow or prevent certain part of a program from being modified by other areas of that program.
  • Access Modifier Keywords: Access modifiers keywords are used when declaring a class, property, field, and other variables.
  • Statement Keywords: Statement keywords are used to create a follow for a program.
  • Method parameter keywords: Method parameter keywords are used in a method signature.
  • Namespace keywords: Namespace keywords are sued with namespaces implementation and related operations.
  • Operator Keywords: Operator keywords are used to implement miscellaneous operations and actions.
  • Access keywords: Access keywords are used to access a base class or class containers.
  • Literal keywords: Literal keywords are used to instances or value of an object.
  • Type keywords: Type keywords are used for data types in C#
  • Contextual Keywords: Contextual keywords are the keywords that are considered as reserved words only if they are used in a certain way. They can be used in class name and other indentifies as they are not reserved words.
  • Query keywords: Query keywords are used in SQL and LINQ queries.

The following table contains all keywords in C#. Keywords are sorted alphabetically and grouped by categories:

KeywordCategoryDescription
abstractModifier keywordsIs used to implement classes, methods, properties, indexers, and events has an incomplete implementation.
. operatorNamespace KeywordsIs used to overload a build-in operator in a class or struct implementation.
:: operatorNamespace KeywordsIs used to search for C# built-in identifiers.
addContextual KeywordsIs used to define an event that is invoked when a client code subscribes to you code.
asOperator KeywordsIs used to perform a type conversion between reference types, or nullable type.
ascendingQuery Keywords
asyncModifier keywords
awaitOperator Keywords
baseAccess keywords
boolType keywords
breakStatement Keywords
byQuery keywords
byteType keywords
caseStatement Keywords
catchStatement Keywords
charType keywords
checkedStatement Keywords
checkedOperator Keywords
classType keywords
constModifier keywords
continueStatement Keywords
decimalType keywords
defaultStatement Keywords
descendingQuery keywords
doStatement Keywords
doubleType keywords
dynamicContextual Keywords
elseStatement Keywords
enumType keywords
equalsQuery keywords
eventModifier keywords
externModifier keywords
extern aliasNamespace keywords
falseLiteral keywords
finallyStatement Keywords
fixedStatement Keywords
floatType keywords
forStatement Keywords
foreachStatement Keywords
fromQuery keywords
globalContextual Keywords
gotoStatement Keywords
groupQuery keywords
ifStatement Keywords
inStatement Keywords
inQuery keywords
intType keywords
internalAccess Modifier KeywordsAllows other program code in the same assembly to access the type or its members.
intoQuery keywords
isOperator Keywords
joinQuery keywords
letQuery keywords
lockStatement Keywords
longType keywords
newModifier keywords
newOperator Keywords
nullLiteral keywords
onQuery keywords
orderbyQuery keywords
outMethod parameter keywords
overrideModifier keywords
partialModifier keywords
privateAccess Modifier KeywordsRestricts other parts of a program from accessing the type and its members and allow code in the same class or struct to access it.
protectedAccess Modifier KeywordsAllows codes in the same class or a class that derives from that class to access the type or its members.
publicAccess Modifier KeywordsAllows any part of a program in a same assembly or another assembly to access the type and its members.
readonlyModifier keywords
refMethod parameter keywords
returnStatement Keywords
sbyteType keywords
sealedModifier keywords
selectQuery keywords
setContextual Keywords
shortType keywords
sizeofOperator Keywords
stackallocOperator Keywords
staticModifier keywords
stringType keywords
structType keywords
switchStatement Keywords
thisAccess keywords
throwStatement Keywords
trueLiteral keywords
tryStatement Keywords
typeofOperator Keywords
uintType keywords
ulongType keywords
uncheckedStatement Keywords
uncheckedOperator Keywords
unsafeModifier keywords
ushortType keywords
usingNamespace keywords
valueLiteral keywords
valueContextual Keywords
varContextual Keywords
virtualModifier keywords
voidLiteral keywords
volatileModifier keywords
whereQuery keywords
whileStatement Keywords
yieldStatement Keywords
Last modified: July 28, 2018

Comments

Write a Reply or Comment

Your email address will not be published.