Книги автора: C# 2008 Programmer
Книга: C# 2008 Programmer
C# Reserved Keywords
C# Reserved Keywords
The following table describes the reserved keywords used in C#.
Keyword | Description |
---|---|
abstract |
A modifier that can be used with classes, methods, properties, indexers, and events. Use it to indicate that a class is intended to be used as a base class of other classes, and abstract methods must be implemented by classes that derive from the abstract class. |
as |
An operator that performs conversion between compatible reference types. |
base |
Used to access members of a base class from a derived class. |
bool |
A C# alias of the System.Boolean .NET Framework type. Its value can either true, false, or null. |
break |
Used to transfer control out of a loop or switch statement. |
byte |
Specifies a data type that can stores unsigned 8-bit integer values from 0 to 255. |
case |
Used together with the switch statement. It specifies the value to be matched so that control can be transferred to the case statement. |
catch |
Used with a try block to handle one or more exceptions. |
char |
Specifies a data type that can store a 16-bit Unicode character from U+0000 to U+ffff. |
checked |
Used to explicitly enable overflow-checking integer operations. |
class |
Used to declare classes. |
const |
Used to specify a field or variable whose value cannot be modified. |
continue |
Used within a loop such that control is transferred to the next iteration. |
decimal |
Specifies a data type representing a 128-bit data. It can approximately represent a number from ±1.0?10-28 to ±7.9?1028. |
default |
Used within a switch statement to indicate the default match if none of the other case statements is matched. Can also be used in generics to specify the default value of the type parameter. |
delegate |
Used to declare a reference type variable that references a method name/anonymous method. |
do |
Executes a block of code repeatedly until a specified expression returns false. Used together with the while keyword to form a do-while statement. |
double |
Specifies a data type that represents a 64-bit floating point number. It can approximately represent a number from ±5.0?10-324 to ±1.7?10308. |
else |
Used with the if keyword to form an if-else statement. else defines the block that will be executed if the expression specified in the if statement is evaluated to false. |
enum |
Used to define an enumeration. |
event |
Used to define an event within a class. |
explicit |
Defines a cast operation that requires the programmer to explicitly select the cast to be performed. |
extern |
Declares a method that is implemented externally. |
false |
Used as either an operator or as a literal. One of the possible values in a bool variable. |
finally |
Used in a try-catch block to contain code that cleans up the code even if an exception occurs. Statements contained within a finally block are always executed. |
fixed |
Prevents the garbage collector from relocating a movable variable. |
float |
Specifies a data type that represents a 32-bit floating point number. It can approximately represent a number from ±1.5?10-45 to ±3.4?1038. |
for |
Encloses a block of statements that will be executed repeatedly until a specified expression returns false. |
foreach |
Used to iterate through a collection of items. |
goto |
Used to transfer control of a program to a labeled statement. |
if |
Determines if a statement (or block of statements) is to be executed based on the result of a Boolean expression. |
implicit |
Used to declare an implicit cast operation. |
in |
Used in a foreach statement to specify the collection you want to iterate through. |
int |
Specifies a data type that represents a signed 32-bit integer number. It can represent a number from -2,147,483,648 to 2,147,483,647. |
interface |
Used to define an interface, which is a definition that contains the signatures of methods, delegates, and events. An interface does not contain any implementation. |
internal |
An access modifier to indicate a member that can only be accessed within files in the same assembly. |
is |
Used to check if an object is compatible with a given type. |
lock |
Marks a statement block as a critical section so that other threads cannot execute the block while the statements within the block are being executed. |
long |
Specifies a data type that represents a signed 64-bit integer number. It can represent a number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. |
namespace |
Used to organize your code so that it belongs to a globally unique type. |
new |
Used to create objects and invoke a class's constructor. Also can be used to explicitly hide a base class's member in a derived class. When used in a generic declaration, it restricts types that might be used as arguments for a type declaration. |
null |
Represents a null reference that does not refer to any object. |
object |
A C# alias of the System.Object .NET Framework type. |
operator |
Used to overload a built-in operator or provide a conversion operator. |
out |
Indicates arguments that are to be passed by reference. It is similar to ref , except that ref requires the variable to be initialized before it is passed. |
override |
Extends or modifies the abstract or virtual implementation of an inherited method, property, indexer, or event. |
params |
Specifies a parameter array where the number of arguments is variable. |
private |
An access modifier used to indicate a member that can only be accessed within the body of the class or struct in which it's declared. |
protected |
An access modifier used to indicate a member that can only be accessed within its class and derived classes. |
public |
An access modifier used to indicate a member that can be accessed by all code. |
readonly |
A modifier that indicates fields that can only be initialized at declaration or in a constructor. |
ref |
Indicates arguments that are to be passed by reference. |
return |
Terminates execution of a method and returns control to the calling method. |
sbyte |
Specifies a data type that represents a signed 8-bit integer number. It can represent a number from -128 to 127. |
sealed |
Specifies a class that does not allow other classes to derive from it. |
short |
Specifies a data type that represents a signed 16-bit integer number. It can represent a number from -32,768 to 32767. |
sizeof |
Used to obtain the size in bytes for a value type. |
stackalloc |
Used in an unsafe code context to allocate a block of memory on the stack. |
static |
A modifier to indicate that a member belongs to the type itself, and not to a specific object. |
string |
Specifies a data type that represents a sequence of zero or more Unicode characters. Also an alias for the System.String .NET Framework type. |
struct |
Denotes a value type that encapsulates a group of related variables. |
switch |
A control statement that handles multiple selections by matching the value of the switch with a series of case statements. |
this |
Refers to the current instance of the class. Also used as a modifier of the first parameter of an extension method. |
throw |
Used to invoke an exception during runtime. |
true |
Used either as an operator or as a literal. One of the possible values in a bool variable. |
try |
Indicates a block of code that may cause exceptions. Used with one or more catch blocks to handle the exceptions raised. |
typeof |
Used to obtain the System.Type object for a type. |
uint |
Specifies a data type that represents an unsigned 32-bit integer number. It can represent a number from 0 to 4,294,967,295. |
ulong |
Specifies a data type that represents an unsigned 64-bit integer number. It can represent a number from 0 to 18,446,744,073,709,551,615. |
unchecked |
Used to suppress overflow-checking for integral-type arithmetic operations and conversions. |
unsafe |
Denotes an unsafe context, which is required for any operation involving pointers. |
ushort |
Specifies a data type that represents an unsigned 16-bit integer number. It can represent a number from 0 to 65,535. |
using |
A directive for creating a namespace alias or importing namespace references. It is also used for defining a scope at the end of which an object will be disposed. |
virtual |
An access modifier to indicate a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. |
volatile |
Indicates that a field might be modified by multiple threads that are executing at the same time. |
void |
Specifies that a method does not return any value. |
while |
Executes a statement or a block of statements until a specified expression evaluates to false. |
Оглавление статьи/книги
Похожие страницы