Profile PictureCesar Aguirre
$9.99+

Getting Started With LINQ in C#

Add to cart

Getting Started With LINQ in C#

$9.99+

Start Working Productively With LINQ in Less Than 2 Hours

Collections are everywhere. Comments in a post, purchased items in an invoice, and guests in a hotel reservation.

We often work with these collections using for, foreach, and other loops. But C#, has a feature specifically designed for working with collections:

Language Integrated Query (LINQ).

With LINQ, you filter, transform, and query collections, using more concise and readable code than traditional loops.

This is the one C# feature you can't ignore. In fact, it's the best of all C# features. Ever.

What you will learn?

In this course, we're covering everything you need to know to start working productively with LINQ, in less than 2 hours.

After taking this course, you will:

  • Understand the key differences between LINQ and loops.
  • Learn the most frequently used LINQ methods for working with collections.
  • Identify and fix common mistakes when using LINQ.
  • Refactor away from conditionals using LINQ.
  • Explore the latest LINQ methods and overloads from recent .NET versions.

What is inside?

LINQ works with XML files and database records. But, in this course, we're focusing on LINQ and collections like arrays and lists.

Think of this course like the 20% of the LINQ features you're using 80% of the time (That's the Pareto Principle, by the way).

In this course, we're not covering every single LINQ method out there, but the most frequently used ones. And that's on purpose. In our every day coding (and jobs) we keep using a handful of methods most of the time, not all of them.

Ready for a preview? Click the video at the top of the page.

These are the modules and lessons inside:

  1. Introduction (3min)
    • Getting Started
    • What's LINQ?
  2. LINQ vs. Loops (20min)
    • Filter Collections Using Where
    • Understand the IEnumerable Type
    • Use LINQ with Older Versions
    • Write Extensions Methods
    • Write Delegates Using Func and Action
    • Write Lambda Expressions
    • Exercise: Find Your Favorite Movies
    • LINQ and Declarative Programming
    • LINQ and Immutability
    • LINQ and Laziness
    • Wrap-up!
  3. Most Common LINQ Methods (55min)
    • Transform a Collection With Select
    • Transform a Collection Using the Position of Elements
    • Query Collections with Any and All
    • Group Elements of a Collection
    • Group Elements and Transform Every Group
    • Group Elements by More Than One Property
    • Use Anonymous Objects With GroupBy
    • Order Elements of a Collection
    • Choose One Element with First and FirstOrDefault
    • Choose One Element with Last and LastOrDefault
    • Choose One Element with Single and SingleOrDefault
    • Choose and Leave Out Elements with Take and Skip
    • Exercise: Write a Paginate Method
    • Exercise: Refactor From Loops to LINQ
    • Query Collections of Numbers With Sum, Min, and Max
    • Flatten a Collection of Collections With SelectMany
    • Find Unique Elements With Distinct
    • Perform Set Operations With Intersect, Union, and Except
    • Exercise: Use LINQ Methods
    • Exercise: Sort by Ocurrences
    • Carry An Operation With Aggregate
    • Use LINQ Query Syntax
    • Wrap-up!
  4. Common LINQ Mistakes (8min)
    • Use the Right LINQ Methods
    • Write Null Checks with FirstOrDefault
    • Avoid Multiple Evaluations of a LINQ Query
    • Exercise: Remove Mistakes
    • Wrap-up!
  5. Refactoring With LINQ (11min)
    • Replace Comparisons with Any
    • Replace a Set of Choices with FirstOrDefault
    • Validate Objects With All
    • Exercise: Add a Recommended Movie
    • Wrap-up!
  6. New LINQ Features (9min)
    • Split a Collection Into Buckets With Chunk
    • Find Unique Elements With DistinctBy
    • Use Take Method with Ranges
    • Use FirstOrDefault with a Safe Default
    • Count Elements of a Collection With CountBy
    • Select Elements And Their Position With Index
    • Wrap-up!
  7. Conclusion (1min)
    • Wrap-up!

Who is this course for?

If you're a beginner or intermediate C# developer who want to write more compact and expressive code when working with collections, this course is for you.

You should be comfortable declaring and initializing C# objects and working with conditionals, loops, and collections such as arrays and lists.

By the end of this course, you'll be ready to productively manipulate collections with LINQ.

Click the "I Want This" button and see you in the first lesson.

$
Add to cart
Watch link provided after purchase
Modules
7
Video Lessons
36
Text Lessons
8
Exercises
7
Cheatsheets
1
Watch Time
1h 46m