Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
C# Performance Tricks: How To Radically Speed Up Your Code.
Rating: 4.5 out of 5(1,702 ratings)
12,003 students

C# Performance Tricks: How To Radically Speed Up Your Code.

This course will help you speed up your C# code and provides many tricks that every professional developer must know.
Created byMark Farragher
Last updated 5/2026
English

What you'll learn

  • Learn the fundamentals of the .NET Framework
  • Enjoy a crash course in Common Intermediate Language
  • What is boxing and unboxing, and how to avoid it?
  • The strange performance gap between 1- and 2-dimensional arrays
  • When should you use a StringBuilder?
  • Garbage collector assumptions about object size and lifetime
  • Using pointers in C# - is it worth the trouble?
  • A super-fast way to construct new objects
  • ... and much more!

Coding Exercises

This course includes our updated coding exercises so you can practice your skills as you learn.

See a demo
Image of coding exercise example

Course content

7 sections38 lectures4h 17m total length
  • Course introduction5:09

    In this lecture I explain how this course is organized and I describe each of the upcoming sections in detail.

  • Meet your instructor3:50

    In this lecture I will tell a bit more about myself, my career, and my motivation to become an online trainer.

  • Introduction to code optimization6:12

    In this lecture we're going to look at the theory behind code optimization. What exactly is code optimization, and when should you do it?

    By the end of this lecture you will have learned the 5 strategies of code optimization, and at which stage in your project you should begin optimizing your code.

  • Windows, OS/X or Linux?3:19

    Many lectures in this course contain the actual source code I used to run my performance measurements. Feel free to download the code and follow along. And here's the good news: it doesn't matter if you have a Window, Mac or Linux computer. The code will run on all three operating systems.

    In this lecture I demonstrate how my solutions and projects run on all operating systems. I will show you how to build and run the source code on a Mac, on Linux and in Visual Studio running on Windows 8.

    At the end of this lecture you will have learned that .NET code is portable and can run on at least five different operating systems.

  • Background Info - About Me1:14

Requirements

  • You need a Windows, Mac or Linux laptop with Microsoft Visual Studio, Xamarin Studio or Monodevelop
  • You should be a beginner, intermediate, or advanced C# developer
  • That's it!

Description

Do you know how to write fast C# code?

You may have already enrolled in a C# programming course, or learned the language at school or university. But here's a sobering fact: most courses only teach you how to write code, not how to write fast code.

The .NET Framework is huge. For any given problem there are many solutions, and it is not always clear which solution is the best choice.

Did you know that adding strings together using the wrong Framework class will slow down your code by a factor of more than two hundred? And if you're not handling exceptions the right way, your code wil run a mind-boggling thousand times slower than normal.

Slow C# code is a big problem. Slow code on the web will not scale to thousands of users. Slow code will make your user interface unusable. Slow code will make your mobile apps languish in the app store.

Slow code is holding you back!

I can help you.

In a series of short lectures I will cover many common performance bottlenecks. I will introduce each problem, and then write a small test program to measure the baseline performance. Then I will demonstrate each possible solution, and benchmark how each solution measures up.

But there's more! I will also dive into Common Intermediate Code (CIL), the language that the C# compiler compiles to. If this sounds daunting, don't worry! The CIL language is actually very easy to read and understand. I'll take you through the basics in a quick 15-minute lecture.

Being able to read CIL code is a very useful skill that will help you avoid many performance pitfalls and give you a deeper understanding of the .NET Framework.

Why should you take this course?

You should take this course if you are a beginner or intermediate C# developer and want to take your skills to the next level. All my lectures are very easy to follow, and I explain all topics with clear code and many instructive diagrams.

Or you might be working on a critical section of code in a C# project, and need to make your code run as fast as possible. The tips and tricks in this course will help you immensely.

Or maybe you're preparing for a C# related job interview? This course will give you an excellent foundation to answer any performance-related questions they might throw at you.

Who this course is for:

  • Beginner, intermediate, and advanced C# programmers who want to learn how to write fast code
  • Developers who are about to take a job interview and need to prepare for performance-related questions
  • Professionals who are writing a section of mission-critical code in a large C# project