C# 14 · Collections and LINQ
Keep unique items
A set rejects duplicates, and Add returns false if the item was already there.
var seen = new HashSet<string>();
bool isNew = seen.Add("Ada");
C# 14 · Collections and LINQ
A set rejects duplicates, and Add returns false if the item was already there.
var seen = new HashSet<string>();
bool isNew = seen.Add("Ada");
Was this page helpful?