Pointers

suggest change

Remarks

Pointers and unsafe

Due to their nature, pointers produce unverifiable code. Thus, usage of any pointer type requires an unsafe context.

The type System.IntPtr is a safe wrapper around a void*. It is intended as a more convenient alternative to void* when an unsafe context isn’t otherwise required to perform the task at hand.

Undefined behavior

Like in C and C++, incorrect usage of pointers can invoke undefined behavior, with possible side-effects being memory corruption and execution of unintended code. Due to the unverifiable nature of most pointer operations, correct usage of pointers is entirely a responsibility of the programmer.

Types that support pointers

Unlike C and C++, not all C# types have corresponding pointer types. A type T may have a corresponding pointer type if both of the following criteria apply:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Pointers:
* Pointers
* void

Table Of Contents
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script