Working with sets

Sets are one of the most fundamental concepts in mathematics. A set is a collection of one or more objects. You might remember being taught about Venn diagrams in school. Common set operations include the intersect or union between sets.

Add a new console application project named LinqWithSets in either Visual Studio 2017 or Visual Studio Code.

In Visual Studio 2017, set the solution's start up project to be the current selection.

This application will define three arrays of strings for cohorts of apprentices and then perform some common set operations.

Import the following additional namespaces:

using System.Collections.Generic; // for IEnumerable<T> 
using System.Linq; // for LINQ extension methods 

Inside the Program

Get C# 7.1 and .NET Core 2.0 – Modern Cross-Platform Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.