Introduction to C# performance

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!

I’ll even give you a crash course in Intermediate Language so that you can actually read the machine language produced by the C# compiler. We’ll compile a couple of code snippets, take a look at the IL code and see if we can make any improvements.

Here’s What You’ll Get

Training Lectures

Video Lessons


C# Optimizations



Training Details

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.


Name: C# Performance Fundamentals.

Format: Self-paced.

Content: training lectures, video lessons, quizzes and coding exercises.

Requirements: a Windows, Mac or Linux laptop with Microsoft Visual Studio or Visual Studio Code.

Support: Slack channel.

Associated certification: none.


Sneak Preview

In this complimentary training lecture I will teach you how to optimize arrays in C#. We’ll look at 1-dimensional arrays, multidimensional arrays and jagged arrays and compare the performance of all three. You will also learn a technique called Array Flattening to speed up 2-dimensional arrays.

Training Curriculum


Course prerequisites

Introduction to code optimization

Fundamentals of the .NET Framework



The Stack


The Heap


Value Types


Reference Types


Boxing and unboxing


Immutable Strings


Basic Optimizations: the low-hanging fruit


How to prevent boxing and unboxing

Fast string concatenation

Fast collections

Fast arrays

Throwing and catching exceptions

For versus Foreach

Coding Exercises



Intermediate Optimizations


Fast Garbage Collection (Part 1 and Part 2) 

Fast delegates

Fast class factories



A crash course in Intermediate Language


Common Intermediate Language



Advanced Optimizations


Arrays on the stack

Pointers (Part 1 and Part 2)

Background Info – Modifying String Constants



In Conclusion

What you´ve learned

Bonus lecture

Sign Up For This Training

You can sign up for this training right now by clicking the button, filling in the checkout form and completing your payment.

Once we have received your payment, you will receive an email within minutes with a link to access the online training platform.

Please note that the listed price is ex VAT. Registered EU businesses with a valid VAT number can defer the VAT during checkout. Non-EU businesses and individuals do not pay VAT.

Looking For Something Else?


Is this online training not what you’re looking for? Then please check out my other C# training courses.

Related Microsoft Training


Would you rather train with your team in a classroom setting? Then please check out my Microsoft C# training courses.

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.

“Mark introduces great and consistent ways to study differences in performance throughout this course. Applies to both business app programmers as well as game devs. Very very good!”

Rune Solberg, online student

See Me In Action


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.

Frequently Asked Questions

  • Classroom Training
  • Microsoft Training
  • Online Training
  • Misc
What is a classroom training?
A classroom training is a live event in which I will present the training lectures and help you complete the lab exercises. You will be sharing the classroom with your colleagues and learn together as a group.
Where is a classroom training conducted?
Depending on your needs, classroom trainings can be conducted on-site at your place of work, in a fully-equipped classroom at a training agency, or online in a multi-day Microsoft Teams or Zoom session.
Who should attend a classroom training?
A classroom training is ideal for tech professionals who can commit to full days of learning and want to learn together as a group.
How am I supported in a classroom training?
I will continuously support you live, because we’ll both be in the same physical or virtual classroom together.
What is a Microsoft training?
A Microsoft training is an official classroom training course from the Microsoft training catalog that will teach you essential tech skills and prepare you for a certification exam.
What's included in a Microsoft training?
You will receive online course content, access to an Azure sandbox environment, lab exercises, a practice exam and an exam voucher.
How long do I have access to a Microsoft training?
You have unlimited access to the training content, 180 days access to the lab environment and 30 days of access to the practice exam. The exam voucher is valid for a year.
How can my team and I attend a Microsoft training?
Please provide your requirements in the form on the training pages and I will contact you as soon as possible to plan and set up your training.
What is an online training?
In an online training you can study the training lectures and work on the lab 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. This training format is ideal for tech professionals who have irregular work hours and cannot commit to a classroom training.
What's included in an online training?
You will receive prerecorded online video lectures, text lectures, multiple-choice quizzes and homework exercises.
How am I supported in an online training?
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 lab exercises and get you ready for your certification exams.
Who should attend an online training?
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.
Are you a certified trainer?
Yes. I started classroom training in 1997 and obtained my Microsoft Certified Trainer (MCT) credential in 2005. I currently have more than 25 years of training experience.
What is the maximum size for a classroom training?
It depends on the size of the classroom, the team and the complexity of the subject. But typically, groups of up to 15 students work best. If you have a larger group, it's best to split them over multiple training sessions.
Can you provide training in a non-English language?
Yes, I am fluent in English, Dutch and German thanks to a multilingual upbringing by my international family. I can provide any training in all three languages.
Will you travel to my country to provide a classroom training?
Yes. I am based in Amsterdam and often travel abroad to provide classroom training in other countries. I love meeting my students on-site, no matter where they live.