Operator Keywords
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Operator Keywords (C# Reference)

Used to perform miscellaneous actions such as creating objects, checking the run-time type of an object, obtaining the size of a type, and so forth. This section introduces the following keywords:

  • as   Converts an object to a compatible type.

  • is   Checks the run-time type of an object.

  • new

  • sizeof   Obtains the size of a type.

  • typeof   Obtains the System.Type object for a type.

  • true   

    • true Operator   Returns the boolean value true to indicate true and returns false otherwise.

    • true Literal   Represents the boolean value true.

  • false   

    • false Operator   Returns the Boolean value true to indicate false and returns false otherwise.

    • false Literal   Represents the boolean value false.

  • stackalloc   Allocates a block of memory on the stack.

The following keywords, which can be used as operators and as statements, are covered in the Statements section:

  • checked   Specifies checked context.

  • unchecked   Specifies unchecked context.

© 2016 Microsoft