From the course: .NET Essentials: Working with LINQ

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Generic types

Generic types

- [Instructor] The concept in this video is another one of those concepts that's has been around since the early early days of .NET. It's the idea of generics. And in .NET, you can have generic classes, shown here, generic methods, generic interfaces, and generic delegates. Generic interfaces are crucial to making LINQ work. We're working with IEnumerable<T> and things like that. So the basics behind generics, if you're not familiar with them, is that the person that creates the type, they create the generic item, they create the generic class with the generic interface with the generic method. And then the developer that's using that type, they decide when they're writing the code what the real type will be for that generic method or that generic class at runtime. So they specify the concrete type in their code. So here's an example. I have a new list and I want to specify it to be a decimal. That's the generic type. Use…

Contents