Managed and Unmanaged Memory is the last chapter of Part I, which not only shows using the IDisposable
interface with the using
statement and the new using
declaration but also demonstrates using the Span
type with managed and unmanaged memory. You can read about using Platform Invoke both with Windows and with Linux environments.
This chapter contains the following code samples:
- PointerPlayground (using pointers with C#, unsafe keyword)
- PointerPlayground2 (adding a struct)
- QuickArray (quick sorting using pointers, stackalloc keyword)
- ReferenceSemantics (ref return, ref local, ref readonly)
- SpanSample (the Span type)
- PlatformInvokeSample (invoking native methods from C#)
For code comments and issues please check Professional C#'s GitHub Repository
Please check my blog csharp.christiannagel.com for additional information for topics covered in the book.
Thank you!