In this course, Working With C# Generics: Best Practices,
you’ll learn to use generics in your own types and classes.
First, you’ll explore generic interfaces and constraints. Next,
you’ll discover the covariance and contravariance. Finally,
you’ll learn how to use generics with events and methods.
When you’re finished with this course, you’ll have the
skills and knowledge of C# generics needed to level up
your .NET apps with cleaner, more reusable code.
Course Overview Hi there. My name is Steve Smith, aka Ardalis, and welcome to my course, C# Generics: Best Practices. I've been working with and teaching students how to be productive with C# since the first version of C# and .NET shipped. My company, NimblePros, helps teams write better code faster, and that's really my motivation for sharing tips and techniques with you here on Pluralsight too. My hope is that after watching this course, even if you've been using generics, you'll have a few new tips or techniques you can apply to your applications. Although generics have been a feature of .NET and C# since about 2005, they've continued to evolve as other new features have been added. Today, I can't imagine writing .NET apps without generics. In this course, we are going to cover some best practices for getting the most out of C# generics. We'll talk about the basics of the features, yes, but we'll go beyond that to show not just how it works, but when and where you should apply them in real code. Some of the major topics that we will cover include how can generic constraints improve your design, when should you use a generic interface, class or method, how can you finally remember the difference between covariance and contravariance, when would you use reflection with generics, and how can you write more flexible code with generic events and delegate types? By the end of this course, you'll be able to apply generics in new and better ways in your applications. You'll be introduced to built‑in types and NuGet packages that can take your generic code usage to the next level. I hope you'll join me in learning how to make the most out of using generics in your C# applications, here in this Pluralsight course.