Hi
Is there any way to perform a Linq OrderBy on a column in an OrderedSet (Iesi.Collection) and get the output as an ordered set. There appears to be no way to convert between IOrderedEnumerable and ISet...
Thanks
Hi
Is there any way to perform a Linq OrderBy on a column in an OrderedSet (Iesi.Collection) and get the output as an ordered set. There appears to be no way to convert between IOrderedEnumerable and ISet...
Thanks
If you want to convert it after the query:
IOrderedEnumerable<int> x = ...
OrderedSet<int> s = new OrderedSet<int>(x.ToArray());
Or wrap it in an extension method for convenience:
public static class EnumerableExtensions {
public static OrderedSet<T> ToOrderedSet<T>(this IEnumerable<T> s) {
return new OrderedSet<T>(s.ToArray());
}
}
IOrderedEnumerable<int> x = ...
OrderedSet<int> s = x.ToOrderedSet();