In the latest version of Iesi.Collections is missing Iesi.Collections.Generic.ISet. There seem to be three alternatives:
- LinkedHashSet
- ReadOnlySet
- SynchronizedSet
Iesi.Collections.Generic.ReadOnlySet seems to be the closest to the ISet, and the documentation states:
... although it's advertised as immutable it really isn't.
Anyone with access to the wrapped set can still change the set.
It seems that the ReadOnlySet is the best replacement for the ISet? Currently the implementation is adding items to a set via public methods so it seems like the best fit. The alternatives (IList, bag?) seem to require more resources or are not as quick/efficient)? Is there a better alternative? (The list shouldn't have duplicates, which could be verified manually)
I'll do stuff like:
public virtual ISet<MyClass> MyClass
{
get { return this.myClass }
}
public virtual void AddItem(MyClass item)
{
... // Null checks and initialize ISet if null
myClass.Add(item)
}
Basically it boils down to the alternatives, are there alternatives without negative consequences such as in speed etc.?