C# Keywords

abstract

A class modifier that specifies a class cannot be instantiated and the full implementation will be provided by a subclass.

A method modifier that specifies a method is implicitly virtual and without an implementation.

alias

Suffixes an extern directive.

as

A binary operator that casts the left operand to the type specified by the right operand and returns null rather than throwing an exception if the cast fails.

ascending

A query comprehension operator used in conjunction with orderby.

base

A variable with the same meaning as this, except that it accesses a base-class implementation of a member.

bool

A logical datatype that can be true or false.

break

A jump statement that exits a loop or switch statement block.

by

A query comprehension operator used in conjunction with group.

byte

A 1-byte, unsigned integral data type.

case

A selection statement that defines a particular choice in a switch statement.

catch

A keyword for the clause in a try statement to catch exceptions of a specific type.

char

A 2-byte, Unicode character data type.

checked

A statement or operator that enforces arithmetic bounds checking on an expression or statement block.

class

A type declaration keyword for a custom reference type; typically used as a blueprint for creating objects.

A generic type constraint, indicating the generic type must be a reference type.

const

A modifier for a local variable or field declaration that indicates that the value is statically evaluated and immutable.

continue

A jump statement that skips the remaining statements in a statement block and continues to the next iteration in a loop.

decimal

A 16-byte precise decimal datatype.

default

A special label in a switch statement specifying the action to take when no case statements match the switch expression.

An operator that returns the default value for a type.

delegate

A type declaration keyword for a type that defines a protocol for a method.

descending

A query comprehension operator used in conjunction with orderby.

do

A loop statement to iterate a statement block until an expression at the end of the loop evaluates to false.

double

An 8-byte, floating-point data type.

else

A conditional statement that defines the action to take when a preceding if expression evaluates to false.

enum

A type declaration keyword that defines a value type representing a group of named numeric constants.

equals

A query comprehension operator that performs an equijoin, used in conjunction with join.

event

A member modifier for a field or property of a delegate type that indicates that only the += and −= methods of the delegate can be accessed.

explicit

An operator that defines an explicit conversion.

extern

A method modifier that indicates that the method is implemented with unmanaged code.

A directive that declares a reference to an external namespace, which must correspond to an argument passed to the C# compiler.

false

A literal of the bool type.

finally

The keyword in the clause of a try statement that executes whenever control leaves the scope of the try block.

fixed

A statement to pin down a reference type so the garbage collector won't move it during pointer arithmetic operations.

A field modifier within an unsafe struct to declare a fixed length array.

float

A 4-byte, floating-point data type.

for

A loop statement that combines an initialization statement, continuation condition, and iterative statement into one statement.

foreach

A loop statement that iterates over collections that implement IEnumerable.

from

A query comprehension operator that specifies the sequence from which to query.

get

The name of the accessor that returns the value of a property.

global

A keyword placed in front of an identifier to indicate the identifier is qualified with the global namespace.

goto

A jump statement that jumps to a label within the same method and same scope as the jump point.

group

A query comprehension operator that splits a sequence into a group given a key value to group by.

if

A conditional statement that executes its statement block if its expression evaluates to true.

implicit

An operator that defines an implicit conversion.

in

The operator between a type and an IEnumerable in a foreach statement.

A query comprehension operator used in conjunction with from.

int

A 4-byte, signed integral data type.

into

A query comprehension operator that specifies a name for an output sequence.

interface

A type declaration keyword for a custom reference type that defines a contract for a type comprising a set of implicitly abstract members.

internal

An access modifier that indicates that a type or type member is accessible only to other types in the same assembly.

is

A relational operator that evaluates to true if the left operand's type matches, is derived from, or implements the type specified by the right operand.

let

A query comprehension operator that introduces a new variable into each element in a sequence.

lock

A statement that acquires a lock on a reference-type object to help multiple threads cooperate.

long

An 8-byte, signed integral data type.

namespace

A keyword for defining a name that encloses a set of types in a hierarchical name.

new

An operator that calls a constructor on a type, allocating a new object on the heap if the type is a reference type or initializing the object if the type is a value type.

A type member modifier that hides an inherited member with a new member with the same signature.

null

A reference-type literal meaning no object is referenced.

object

A predefined type that is the ultimate base class for all types.

on

A query comprehension operator used in conjunction with join or group.

operator

A method modifier that overloads operators.

orderby

A query comprehension operator that sorts a sequence.

out

A parameter and argument modifier that specifies that the variable is passed by reference and must be assigned by the method being called.

override

A method modifier that indicates that a method of a class overrides a virtual method defined by a base class.

params

A parameter modifier that specifies that the last parameter of a method may accept multiple parameters of the same type.

partial

A class or method modifier that indicates the definition of the class or method is split (typically across files).

private

An access modifier that indicates that only the containing type can access the member.

protected

An access modifier that indicates that only the containing type or derived types can access the member.

public

An access modifier that indicates that a type or type member is accessible to all other types.

readonly

A field modifier specifying that a field can be assigned only once, either in its declaration or in its containing type's constructor.

ref

A parameter and argument modifier that specifies that the variable is passed by reference and is assigned before being passed to the method.

return

A jump statement that that exits a method, specifying a return value when the method is not void.

sbyte

A 1-byte, signed integral data type.

sealed

A class modifier that indicates a class cannot be derived from.

set

The name of the accessor that sets the value of a property.

short

A 2-byte, signed integral data type.

sizeof

An operator that returns the size in bytes of a struct.

stackalloc

An operator that returns a pointer to a specified number of value types allocated on the stack.

static

A type member modifier that indicates that the member applies to the type rather than to an instance of the type.

A class modifier indicating the class is comprised of only static members and cannot be instantiated.

string

A predefined reference type that represents an immutable sequence of Unicode characters.

struct

A type declaration keyword for a custom value type; typically used as a blueprint for creating light-weight instances.

A generic type constraint, indicating the generic type must be a value type.

switch

A selection statement that allows a selection of choices to be made based on the value of a predefined type.

this

A variable that references the current instance of a class or struct.

A parameter modifier for the first parameter in a static method, making the method an extension method.

throw

A jump statement that throws an exception when an abnormal condition has occurred.

true

A literal of the bool type.

try

A statement that defines a statement block where errors can be caught and handled.

typeof

An operator that returns the type of an object as a System.Type object.

uint

A 4-byte, unsigned integral data type.

ulong

An 8-byte, unsigned integral data type.

unchecked

A statement or operator that prevents arithmetic bounds checking on an expression.

unsafe

A type modifier, member modifier, or statement that permits executing code that is not type-safe (notably, that uses pointer arithmetic).

ushort

A 2-byte, unsigned integral data type.

using

A directive that specifies that types in a particular namespace can be referred to without requiring their fully qualified type names.

A statement that allows an object implementing IDisposable to be disposed of at the end of the statement's scope.

value

A name used for the implicit variable set by the set accessor of a property.

virtual

A class method modifier that indicates that a method can be overridden by a derived class.

void

A keyword used in place of a type for methods that don't have a return value.

volatile

A field modifier indicating that a field's value may be modified in a multithreaded scenario; neither the compiler nor runtime should perform optimizations with that field.

while

A loop statement to iterate a statement block while an expression at the start of each iteration evaluates to false.

yield

A statement that yields the next element from an iterator block.

Get Programming C# 3.0, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.