Write Performative Programs with C#
4h 16mIntermediate2023-07-14
Authors

Microsoft Press
Microsoft

Markus Reynolds
Course details
If you’re looking to learn more about high-performance programming, this course was made for you. Join expert Microsoft developer and trainer Markus Reynolds as he demonstrates how to escape the virtual machine, embrace low-level programming techniques with C# and Rust, and create efficient, lightning fast programs on .NET 7. Review the basics of .NET memory management, efficient collections, new memory classes, pointers and unsafe code, platform invoke, and more. Along the way, gather insights for Markus on how to compile native code into a native library to pass data back and forth using Rust. By the end of this course, you’ll be prepared to take your new skills to the next level as a C# developer.
Skills covered
Programming LanguagesSoftware DevelopmentOne-Off
Concepts
Introduction
- Introduction
.NET Memory Management
- Learning objectives
- Learn reference types and value types
- Understand passing by reference and by value
- Understand the stack versus the heap
- Understand structs
- Understand function pointers
Efficient Collections
- Learning objectives
- Understand how collections are allocated
- Learn how to calculate the algorithmic time and space complexity of an operation
- Program a program with complexity in mind
- Learn how to easily parallelize operations on a collection
- Learn the differences between classes, records, and immutable dictionaries and when to use each
- Understand LINQ performance
New Memory Classes
- Learning objectives
- Learn the Span class
- Learn the Memory class
- Program a simple example program using Span, memory, structs, and function pointers
Pointers and Unsafe Code
- Learning objectives
- Learn pointers
- Learn marshalling
- Learn stackalloc
- Learn GlobalAlloc
- Use unsafe code
- Program a memory-efficient web scraper
Platform Invoke
- Learning objectives
- Learn how to platform invoke
- Understand DLL import versus library import
- Pass data between .NET and a native DLL
- Program a native Win32 GUI application
FFI and Native Libraries
- Learning objectives
- Learn about Rust
- Build a Rust DLL
- Learn how to pass data between Rust and C#
- Program a native algorithm
Conclusion
- Summary