ECMA-334 C# Language Specification

25.5: Pointers in expressions

In an unsafe context, an expression may yield a result of a pointer type, but outside an unsafe context it is a compile-time error for an expression to be of a pointer type. In precise terms, outside an unsafe context a compile-time error occurs if any simple-name (14.5.2), member-access (14.5.4), invocation-expression (14.5.5), or element-access (14.5.6) is of a pointer type.

In an unsafe context, the primary-no-array-creation-expression (14.5) and unary-expression (14.6) productions permit the following additional constructs:

primary-no-array-creation-expression
...
pointer-member-access
pointer-element-access
sizeof-expression
unary-expression
...
pointer-indirection-expression
addressof-expression
These constructs are described in the following sections.
[Note: The precedence and associativity of theunsafe operatorsis implied by the grammar. end note]

In This Section: