Set operations (Union, Intersect, Except) in C#
📖 Scenario: You are managing two lists of favorite fruits from two friends. You want to find fruits they both like, fruits either one likes, and fruits only one friend likes.
🎯 Goal: Build a C# program that uses set operations Union, Intersect, and Except on two lists of fruits.
📋 What You'll Learn
Create two lists of strings named
friend1Fruits and friend2Fruits with exact fruits given.Create a variable
allFruits that is the union of both lists.Create a variable
commonFruits that is the intersection of both lists.Create a variable
uniqueToFriend1 that contains fruits only in friend1Fruits but not in friend2Fruits.Print the results exactly as instructed.
💡 Why This Matters
🌍 Real World
Set operations help compare collections like user preferences, inventory lists, or survey answers.
💼 Career
Understanding set operations is useful for data analysis, filtering data, and combining information efficiently in software development.
Progress0 / 4 steps