C# Question

What is comparison operator for references?

I can create set of pointers in c++ like that:

std::set<Data*> data_set;

Is there similar way to write that:

SortedSet<Data> data_set;

Edit: I want to use similar order logic in c#. Data is simple derived class of Object.

Answer Source

Try to use HashSet. A set is a collection that contains no duplicate elements

HashSet<Data> data_set = new HashSet<Data>();
data_set.Add(new Data());