45
45
10
13
This course will teach you how to speed up your C# code with performance tricks that every professional developer should know.
You’ll learn the fundamentals of the .NET Framework, how the Garbage Collector works, the difference between the stack and the heap, what boxing and unboxing is, and much more!
We’ll also look at array performance, using pointers in C# to manipulate memory directly, and a neat trick to place an array in stack memory for extra performance.
Throughout the course we will be compiling C# code snippets into Intermediate Language, and then inspecting the compiled code for performance bottlenecks. You’ll learn how to interpret basic IL instructions and read machine code directly.
The training covers the following topics:
The Stack
The Heap
Value Types
Reference Types
Boxing
Unboxing
Immutable Strings
Common Intermediate Language
The LDC Instruction
The LDLOC Instruction
The ADD Instruction
The STLOC Instruction
The LDELEM/STELEM Instructions
Other Common IL Instructions
Analyzing Compiled C# Code
Preventing Boxing and Unboxing
String versus StringBuilder Types
Collection Class Performance
Compiled 1-Dimensional Arrays
Compiled 2-Dimensional Arrays
Compiled Jagged Arrays
The Exception Overhead
For versus ForEach Performance
The Garbage Collector
Generation 0, 1 and 2 Heaps
The Large Object Heap
Optimizing for Generation 0
Optimizing for Object Size
Optimizing for Object Lifetime
Unicast Delegate Performance
Multicast Delegate Performance
Dynamic Instantiation Performance
Dynamic Method Delegate Performance
Allocate Arrays on the Stack
Pointers in C#
Fixing Heap Memory
Referencing a Pointer
Dereferencing a Pointer
Incrementing a Pointer
Optimizing C# code with Pointers
Check out this lesson preview in which I will show you how the C# compiler treats 1-dimensional, multidimensional and jagged arrays differently. Find out which array type performs best.
The video covers Arrays and Intermediate Language.
Here are four C# code optimization slides from the training. You can apply these optimizations to C# code to obtain the best possible performance.
Understand the boxing operation so that you can avoid it in mission-critical code
Learn how to efficiently manipulate strings in C# without breaking the heap
Understand how the Garbage Collector works, so you can use it to your advantage
Learn how to use pointers in C# to access and manipulate heap memory directly
Would you like a sneak peek at the labs in this course? These blog articles address specific performance optimizations and are based on actual lab assignments in this training courses.
For this course you will need a computer (running Windows, MacOS, or Linux), Microsoft Visual Studio Code, and the NET Core SDK.
Choose the plan that works best for you. Buy this course and dive into C# performance optimization, or unlock unlimited access to every course on the site.
Want the best learning experience?
Members get access to the full course library, all labs and community pages, receive priority support and sneak previews of future course releases.
Prices shown exclude VAT. EU businesses can defer VAT during checkout with a valid VAT ID number.
Buy this course and get lifetime access to all lectures and knowledge quizzes
✔️ This course
✔️ Included quizzes only
✔️ Included labs only
🚫 No priority support
🚫 No community access
🚫 No future courses
€95 one time
Get access to all courses, lectures, labs, quizzes, and future releases
✔️ All courses
✔️ All quizzes
✔️ All labs
✔️ Priority support
✔️ Community pages
✔️ Access to future courses
€35 p/mo or €350 p/yr
In-company or online team training with guided labs and live support
🪙 Onsite or online
🪙 Conducted live
🪙 For teams of 5-12
🪙 3-day training
🪙 Guided labs
🪙 Can be customized
€1250 p/day
As a Unity developer and C# coder, this course was perfect for me. It is a fantastic course and an eye opener. Thanks to this course, I have seen a great improvement in my game development by implementing the knowledge I discovered.
A great course to learn some of the speed enhancements within the .NET framework. The content is straightforward to follow and also goes into great depth. The speed test examples and details of the CIL code were enlightening.
I hope I've given you a clear overview of the contents of this training course. But if anything is still unclear and you have some unanswered questions, then please check out this FAQ section
In an online training you can study the training lectures and work on the homework assignments in your own time and at your own pace. You can spend as many or as little hours per week as you want on the training.
You will receive prerecorded online video lectures, text lectures, multiple-choice quizzes and homework exercises.
You are supported through email, and you can also book a 30-minute video support call with me if you want. I will help you with the training lectures and homework projects and get you ready for your certification exams.
An online training is ideal for tech professionals who want to set their own learning pace and prefer to work independently with a bit of guidance and support throughout the training.
I host all my training content on Podia, a well-known e-learning platform based in the United States.
You have unlimited access to the online training content and your login account will never expire.
Yes! I often host classroom trainings where I teach tech subjects to an entire business team. Contact me and we'll get it organised.
C# PERFORMANCE TRAINING FOR THE DUTCH ARMED FORCES IN AMERSFOORT
In 2022 I gave a C# Performance training for the Dutch armed forces who are using .NET code in some of the embedded systems of their artillery vehicles. In a 3-day training I showed military software developers how to optimize the performance of C# code running on a restricted hardware platform.
Unfortunately I wasn’t allowed to take pictures of the team or the barracks, so all I can show you is a photo of this very cool old tank that was parked next to the army museum.
Sign up for the newsletter and get notified when I publish new posts and articles online.
Let's stay in touch!