C# 11 introduces a new usage of the 'ref' keyword. Here we look at all the all the ways it can be applied, and how they fit together.
Source code available at: https://github.com/JasperKent/Use-of-Refs
Topics include:
- Passing by reference
- Returning by reference
- Referencing local variables
- Reference structs
- Reference fields
- Managed references vs Managed pointers
- Spans in .NET 6 and .NET 7
- Checking references for null
- Making refs readonly
- C++ const pointers