Key Word - C#
Key Word - C#
C# Keywords Table - Table of C# keywords and Descriptions. C# was a language developed by the Microsoft
Corporation in the late 1990’s. It is an object oriented language that resembles both C and Java. The C#
keywords reflect it’s origins as an off shoot of the C language. The following C# keywords are the building blocks
of the programming language. A C# program is constructed by creating a syntactically and procedurally correct
program file that can be compiled by a C# compiler.
Code Description
The abstract modifier can be used with classes, methods, properties, indexers, and
abstract
events.
as The as operator is used to perform conversions between compatible types.
The base keyword is used to access members of the base class from within a derived
base
class
The bool keyword is an alias of System.Boolean. It is used to declare variables to
bool
store the Boolean values, true and false.
The break statement terminates the closest enclosing loop or switch statement in
break
which it appears.
The byte keyword denotes an integral type that stores values as indicated in the
byte
following table.
The switch statement is a control statement that handles multiple selections by
case
passing control to one of the case statements within its body.
The try-catch statement consists of a try block followed by one or more catch
catch
clauses, which specify handlers for different exceptions.
The char keyword is used to declare a Unicode character in the range indicated in the
char
following table.
The checked keyword is used to control the overflow-checking context for integral-
checked
type arithmetic operations and conversions.
class Classes are declared using the keyword class.
const The const keyword is used to modify a declaration of a field or local variable.
The continue statement passes control to the next iteration of the enclosing iteration
continue
statement in which it appears.
decimal The decimal keyword denotes a 128-bit data type.
The switch statement is a control statement that handles multiple selections by
default
passing control to one of the case statements within its body.
A delegate declaration defines a reference type that can be used to encapsulate a
delegate
method with a specific signature.
The do statement executes a statement or a block of statements repeatedly until a 1/4
10/21/13 DevList Home Page
The do statement executes a statement or a block of statements repeatedly until a
do
specified expression evaluates to false.
double The double keyword denotes a simple type that stores 64-bit floating-point values.
The if-else statement selects a statement for execution based on the value of a
else
Boolean expression.
The enum keyword is used to declare an enumeration, a distinct type consisting of a
enum
set of named constants called the enumerator list.
event Specifies an event.
The explicit keyword is used to declare an explicit user-defined type conversion
explicit
operator
Use the extern modifier in a method declaration to indicate that the method is
extern
implemented externally.
false In C#, the false keyword can be used as an overloaded operator or as a literal
finally The finally block is useful for cleaning up any resources allocated in the try block.
fixed Prevents relocation of a variable by the garbage collector.
float The float keyword denotes a simple type that stores 32-bit floating-point values.
The for loop executes a statement or a block of statements repeatedly until a
for
specified expression evaluates to false.
The foreach statement repeats a group of embedded statements for each element in
foreach
an array or an object collection.
goto The goto statement transfers the program control directly to a labeled statement.
The if statement selects a statement for execution based on the value of a Boolean
if
expression.
The implicit keyword is used to declare an implicit user-defined type conversion
implicit
operator.
The foreach,in statement repeats a group of embedded statements for each element
in
in an array or an object collection.
int The int keyword denotes an integral type that stores values according to the size and
range shown in the following table.
An interface defines a contract. A class or struct that implements an interface must
interface
adhere to its contract.
internal The internal keyword is an access modifier for types and type members.
The is operator is used to check whether the run-time type of an object is compatible
is
with a given type.
The lock keyword marks a statement block as a critical section by obtaining the
lock mutual-exclusion lock for a given object, executing a statement, and then releasing
the lock.
The long keyword denotes an integral type that stores values according to the size 2/4
10/21/13 DevList Home Page
The long keyword denotes an integral type that stores values according to the size
long
and range shown in the following table.
The namespace keyword is used to declare a scope. This namespace scope lets you
namespace
organize code and gives you a way to create globally-unique types.
new In C#, the new keyword can be used as an operator or as a modifier.
The null keyword is a literal that represents a null reference, one that does not refer
null
to any object.
object The object type is an alias for System.Object in the .NET Framework.
operator The operator keyword is used to declare an operator in a class or struct declaration.
The out method parameter keyword on a method parameter causes a method to refer
out
to the same variable that was passed into the method
override Use the override modifier to modify a method, a property, an indexer, or an event.
The params keyword lets you specify a method parameter that takes an argument where the number of
params arguments is variable.
private The private keyword is a member access modifier.
protected The protected keyword is a member access modifier.
public The public keyword is an access modifier for types and type members.
readonly The readonly keyword is a modifier that you can use on fields.
The ref method parameter keyword on a method parameter causes a method to refer
ref
to the same variable that was passed into the method.
The return statement terminates execution of the method in which it appears and
return returns control to the calling method.
The sbyte keyword denotes an integral type that stores values according to the size and range shown in
sbyte the following table.
sealed A sealed class cannot be inherited.
The short keyword denotes an integral data type that stores values according to the size and range
short shown in the following table.
sizeof The sizeof operator is used to obtain the size in bytes for a value type.
stackalloc Allocates a block of memory on the stack.
Use the static modifier to declare a static member, which belongs to the type itself
static
rather than to a specific object.
string The string type represents a string of Unicode characters.
A struct type is a value type that can contain constructors, constants, fields,
struct
methods, properties, indexers, operators, events, and nested types.
The switch statement is a control statement that handles multiple selections by
switch
passing control to one of the case statements within its body.
this The this keyword refers to the current instance of the class. Static member functions
do not have a this pointer. 3/4
10/21/13 DevList Home Page
this
do not have a this pointer.
The throw statement is used to signal the occurrence of an anomalous situation
throw
(exception) during the program execution.
true In C#, the true keyword can be used as an overloaded operator or as a literal.
The try-catch statement consists of a try block followed by one or more catch
try
clauses, which specify handlers for different exceptions.
typeof The typeof operator is used to obtain the System.Type object for a type.
The uint keyword denotes an integral type that stores values according to the size and range shown in the
uint following table.
The ulong keyword denotes an integral type that stores values according to the size and range shown in
ulong the following table.
The unchecked keyword is used to control the overflow-checking context for integral-
unchecked
type arithmetic operations and conversions.
unsafe The unsafe keyword denotes an unsafe context, which is required for any operation involving pointers.
The ushort keyword denotes an integral data type that stores values according to the size and range
ushort shown in the following table.
using The using keyword has two major uses.
The virtual keyword is used to modify a method or property declaration, in which case
virtual the method or the property is called a virtual member.
The volatile keyword indicates that a field can be modified in the program by something such as the
volatile operating system, the hardware, or a concurrently executing thread.
void When used as the return type for a method, void specifies that the method does not return a value.
The while statement executes a statement or a block of statements until a specified
while
expression evaluates to false.
www.devlist.com
4/4