| ||Introduction to C# - slide 11 : 43|
Pointers and references
References in C# can be understood as a very restricted notion of pointers, as known from C programming
- In normal C# programs: Pointers are not used
- All the complexity of pointers, pointer arithmetic,
dereferencing, and the address operator is not
found in normal C# programs
- In specially marked unsafe sections: Pointers can be used almost as in C.
- Do not use them in your C# programs!
- Objects (instance of classes) are always accessed via references in C#
- References are automatically dereferenced in C#
- There are no particular operators in C# that are related to references
Demonstrations of references in C#.
Output from the reference demo program.
There is no particular complexity in normal C# programs due to use of references