Module 05 of 12

Collections & Generics

Lessons

About This Module

Nearly every program works with groups of data: a list of customers, a lookup of prices by product, a queue of jobs. C# gives you a rich set of collection types for this, and choosing the right one affects both how readable your code is and how well it performs.

This module starts with arrays, the fixed-length collection, and moves to the flexible List<T>. It then covers the Dictionary for fast lookups by key, and finishes with generics, the feature behind all of these types, including how to write your own generic methods and classes and how to constrain them.

Watch the lessons in order, then continue on to LINQ.

Lessons

4 videos
01

C# for Beginners Part 5 - Arrays and More Loops

Layla Porter explains arrays as fixed-length collections, loops over them, and shows what happens when you need to add items, the natural lead-in to lists.

02

C# for Beginners Part 7 - Querying Data with LINQ

Layla Porter shows how a C# list stores and manipulates a collection of elements, building and filling a list before querying it. It also previews the next module.

03

The Dictionary Data Structure in C# in 10 Minutes or Less

Tim Corey gives a concise, practical guide to dictionaries, from looking up a value by its key to a dictionary that maps each key to a list of values.

04

How To Create Generics in C#, Including New Features

Tim Corey explains why generics matter and how to create them, starting from List<T> and moving on to generic methods, classes, interfaces, and constraints.