开发者

Orderby on an Iesi set

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...

开发者_StackOverflow社区

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜