Mastering LINQ with C# and .NET
4.3 (115 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
865 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Mastering LINQ with C# and .NET to your Wishlist.

Add to Wishlist

Mastering LINQ with C# and .NET

Learn .NET's secret sauce for querying collections and databases
Bestselling
4.3 (115 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
865 students enrolled
Created by Dmitri Nesteruk
Last updated 1/2017
English
Current price: $10 Original price: $50 Discount: 80% off
5 hours left at this price!
30-Day Money-Back Guarantee
Includes:
  • 3.5 hours on-demand video
  • 2 Articles
  • 18 Supplemental Resources
  • 4 Coding exercises
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Create and execute LINQ queries on data sets
  • Perform ad hoc data queries on in-memory and external data sources
  • Query databases
  • Write your own LINQ operators
  • Use advanced libraries and approaches for data querying
View Curriculum
Requirements
  • Basic knowledge of C#
  • Basic understanding of C# collection types (e.g., array, list, etc.)
  • Understanding of extension methods
Description

This is a comprehensive course on a technology called Language Integrated Query (LINQ). LINQ is a core part of .NET that is responsible for helping us iterate through, filter, search, transform and manipulate collections, be it local objects (arrays, lists, etc.) or remote objects (e.g., databases).

This course covers:

  • What LINQ is, how it's implemented and what interfaces it uses
  • Main LINQ operators (there are lots of them!)
  • Using LINQ to query databases (LINQ to Entities)
  • Technologies with LINQ support (e.g., LINQ to XML)
  • Parallel LINQ (PLINQ) and how to use it to parallelize your queries
  • Extra topics (e.g., LINQ tool support in Rider/ReSharper, using MoreLINQ)
Who is the target audience?
  • Beginner and experienced .NET/C# developers
  • Anyone interested in modern approaches to data query
  • Database administrators interested in writing data query C#
Students Who Viewed This Course Also Viewed
Curriculum For This Course
42 Lectures
03:32:46
+
Introduction
1 Lecture 04:01

A look at what we'll see in this course as a whole.

Preview 04:01
+
Getting Started with LINQ
7 Lectures 32:33

An overview of the topics we are going to cover in this section.

Preview 00:53

A discussion of LINQ operators and how they are used; we also discuss the two types of execution (immediate vs. deferred) and, in the case of deferred, discuss streaming vs. non-streaming operators.

How LINQ Works
07:04

LINQ operates on two key interfaces. One of the two interfaces is IEnumerable<T>. In this lecture we discuss this interface (as well as the related IEnumerator<T>) and look at some of their aspects. We also discuss how to implement the interface for your own class.

IEnumerable<T>
05:09

So... what does IEnumerable<T> look like, and how do you implement it for your own types?

Preview 06:21

LINQPad is a fantastic tool, specifically designed for learning LINQ. Best of all, it's free! Download and install it right now, we'll be using it throughout the entire course!

Start Using LINQPad
04:07

Static Enumerable methods that help us generate sequences.

Generation Operations
04:59

A summary of what we've learned in this section.

Summary
04:00
+
Linq Operators in Detail
16 Lectures 01:41:44

An overview of what we are going to look at, and a discussion of immediate vs. deferred query operators.

Preview 03:57

A small reminder regarding the naming of sample files.

Reminder re: Samples
00:16

Operations for converting a sequence to something else:

  • Cast converts an IEnumerable to an IEnumerable<T>, i.e. adds strong typing
  • ToXxx methods convert an IEnumerable<T> to an array, vector or dictionary (this forces the iteration of all elements, by the way, so don't do it more than once!)
  • AsXxx methods all 'change the game' to IEnumerable<T>, IQueryable<T> or ParallelEnumerable<T>
Converting Data Types: Cast, ToXxx and AsXxx
06:50

Projection operations (also called mapping) simply takes each element and processes it, yielding something else. If that something else is a collection, you might need SelectMany() to flatten the sequence.

Preview 13:02

Filtering lets you only keep the sequence elements you need and throw away the rest.

Filtering Data: OfType and Where
03:26

Projection and Filtering
1 question

Learn to order data and perform partial ordering. Also we learn how to reverse a string!

Sorting Data: OrderBy, ThenBy, Reverse
11:40

Putting data into groups by a specified key.

Grouping Data: GroupBy and IGrouping<T>
08:04

Operations on algebraic sets. Reminder: duplicate elements are ignored!

Set Operations: Distinct, Except, Intersect, Union
05:17

Set Operations
1 question

Quantifier operations are very simple:

  • All checks that every single element satisfies some predicate
  • Any checks that at least one element satisfies a predicate
  • Contains checks whether the sequence contains the specified value
Quantifier Operations: All, Any and Contains
03:58

Skip and Take lets us take skip or take only a part of a sequence (e.g., only the first 10 elements).  The While() variants only perform the skipping/taking while the elements satisfy some condition.

Partitioning Data: Skip(While) and Take(While)
03:41

Quantifiers and Partitioning
1 question

Join operations are useful for associating elements from different sequences. They are also reasonably difficult to understand, so we'll take it slow.

Join Operations: Join and GroupJoin
07:56

Two things here. One, we'll see SequenceEqual, the useful LINQ operator for comparing the contents of collections. And how do you test collections for equality? What about testing collection contents while ignoring the order of elements?

Equality Operations (SequenceEqual, NUnit comparisons)
05:41

Simple operations for getting a first or last element, for getting the one-and-only element in the collection (assuming there's only one) or just getting the element at the specified position.

Element Operations: First, Last, Single, ElementAt
07:01

Joining two LINQ sequences together is easy. But what about prepending values to the start of the sequence?

Concatenation Operations (Concat)
03:05

Aggregation operations collapse a sequence to a single value. Typical examples are the calculation of the number of elements, the sum or average of a numeric sequence.

Aggregation Operations: Aggregate, Count, Statistical Functions
10:16

Aggregation Operations
1 question

A summary of all the LINQ operators that we've met in this section of the course.

Summary
07:34
+
LINQ and Databases
6 Lectures 22:03

An overview of what we are going to discuss in this section.

Preview 03:08

The magic of converting LINQ queries to SQL database queries is made possible by expression trees.

The Magic of Expression Trees (Expression<T>)
04:27

Just like IEnumerable<T>, IQueryable<T> provides a set of LINQ operators, but it's designed for querying databases and a remote sources. As a result, the operators take Expression<> instead if Func<>.

IQueryable<T>
03:17

Time to put IQueryable<T> to use with LINQ by querying a database using LINQ to Entities.

LINQ to Entities (Entity Framework)
05:54

Entity Framework provides additional LINQ operators that end with Async. What can they be used for?

Async LINQ Queries (Entity Framework)
04:03

A summary of all the things we've learned in this section.

Summary
01:14
+
Parallel LINQ
6 Lectures 27:01

An overview of lectures in this section.

Preview 01:40

AsParallel() turns an IEnumerable<T> into a ParallelQuery<T>

AsParallel and ParallelQuery
08:55

PLINQ takes cancellation tokens and throws either AggregateException or OperationCancelledException.

Cancellation and Exceptions
06:24

Do you want results as quickly as possible? Or should PLINQ cluster results together and return them in batches?

Merge Options
04:20

The LINQ Aggregate() function has a special PLINQ overload.

Custom Aggregation
04:26

A summary of the features available in Parallel LINQ.

Summary
01:16
+
Extra Topics
6 Lectures 25:23

An overview of the things we'll encounter in this section. N.b. this section is also the place where user-requested topics will appear. If you see that something's missing, request it and I'll try to record and post a video on it!

Overview
01:09

LINQ to XML isn't specifically about applying LINQ... more about having an OOP representation of XML. But yes, you can also use LINQ if you want to.

LINQ to XML (System.Xml.Linq)
06:29

ReSharper and Rider provide code analysis and context actions on LINQ queries. Just don't try to turn every loop into a LINQ expression - you might not enjoy the results!

LINQ Support in ReSharper/Rider
06:50

What's that, you want more LINQ? Oh, alright then. MoreLINQ is a library that provides a few more LINQ-style operators.

MoreLINQ
08:34

A summary of this entire course. Thanks for watching!

Course Summary
02:00

Would You Like to Know More?
00:21
About the Instructor
Dmitri Nesteruk
4.5 Average rating
1,027 Reviews
10,384 Students
14 Courses
Quant Finance • Algotrading • Software/Hardware Engineering

Dmitri Nesteruk is a developer, speaker and podcaster. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.

Dmitri is a graduate of University of Southampton (B.Sc. Computer Science) where he currently holds a position as a Visiting Researcher. He is also an instructor on an online intro-level Quantitative Finance course, and has also made online video courses on CUDA, MATLAB, D, the Boost libraries and other topics.