Set Theory and .NET
Asked Answered
U

2

6

Recently I came across a situation where set theory and set math fit what I was doing to the letter (granted there was an easier way to accomplish what I needed - i.e. LINQ - but I didn't think of that at the time). However I didn't know of any generic set libraries. Granted IEnumerables provide some set operations (Union, etc.), but nothing like Intersection or set comparison. Can anyone point out something that fits here? Something that implements set math using a generic type?

Uraninite answered 24/5, 2010 at 11:20 Comment(0)
T
6

There is HashSet<T> in the framework (3.5+) that does what you need. .NET 4 also introduced SortedSet<T> and a common interface ISet<T>.

Tetraploid answered 24/5, 2010 at 11:23 Comment(0)
F
1

System.Collections.Generic.HashSet has a number of set operations including Subset, Superset,Intersection,Union etc.

http://msdn.microsoft.com/en-us/library/bb359438.aspx

I hope this helps

joe

Furore answered 24/5, 2010 at 11:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.