C# 9 Generics
Generics allow you to write type-safe, reusable, and performant C# code. This course will teach you how to build generic classes, generic interfaces, and generic methods, and how to use them in your .NET applications.
What you'll learn
Generics are a powerful feature of the C# language, they allow you to write type-safe, reusable, and performant code. In this course, C# 9 Generics, you’ll learn to build and use generic types in your .NET applications. First, you’ll explore the need for generics in C#. Next, you’ll discover how to build and use generic classes, interfaces, methods, and delegates. Finally, you’ll learn how generics behave in special cases, like with static members and mathematical operators. When you’re finished with this course, you’ll have the skills and knowledge of C# Generics needed to build and use your own generic types in your .NET applications.
Table of contents
- Version Check 0m
- Introduction 2m
- How This Course Is Structured 2m
- Implement a Stack Class for Doubles 9m
- The New Requirement 2m
- Use Object to Support Any Type 8m
- Copy and Paste for Victory 4m
- Create a Generic Stack Class 5m
- Know the Advantages of Generics 2m
- Use the Stack<T> Class of .NET 3m
- Summary 1m
- Introduction 1m
- Add a Non-generic Method 3m
- Create a Generic Method 7m
- Build a Generic Extension Method 4m
- Write a Generic Method with Return Value 6m
- Add a Non-generic Delegate 4m
- Create a Generic Delegate 3m
- Understand Variance with Generic Delegates 5m
- Use the Action<T> Delegate 2m
- Create Events with EventHandler<T> 5m
- Summary 1m
Course FAQ
In this course, you will learn what the need for generics is and how to implement generic classes, how to create generic interfaces, write generic methods, and use generic delegates.
The only prerequisite for this course is a basic understanding of the C# programming language.
Generics are the general form, not specific. Generics allow you to define the specification of the data type of programming elements in a class or method until it is actually used in the program.
.NET is a software framework for building different types of applications. In this course, .NET is the tool that lets you build and run C# programs.
This C# tutorial is for anyone who wants to learn how to build and use generic types in a .NET application.