Set difference algorithm for .NET generic collections?

  • Thread starter Thread starter Duncan Smith
  • Start date Start date
D

Duncan Smith

Just before I have to implement my own.. I don't suppose the .NET
framework has an equivalent of the STL set_difference algorithm
yet...?

For e.g. If I have two containers: CompareSet={1,2,3} ToSet={2,3,4}
then diff(CompareSet,ToSet) = {4} and diff(ToSet,CompareSet) = {1}

Thanks,

Duncan
 
Just before I have to implement my own.. I don't suppose the .NET
framework has an equivalent of the STL set_difference algorithm
yet...?

For e.g. If I have two containers: CompareSet={1,2,3} ToSet={2,3,4}
then diff(CompareSet,ToSet) = {4} and diff(ToSet,CompareSet) = {1}

The framework doesn't have the concept of a Set class. However, there
is on codeproject a set of classes (no pun intended <g>) at
http://www.codeproject.com/csharp/Types_Set.asp that you may be able
to modify to suit your needs.
 
It doesn't have a concept of a Set class, YET. .NET 3.5 (in beta now)
has a HashSet class which actually implements this logic for you, and will
be in the next release.
 
Back
Top