Tag: ilienumerable ilist

为什么List 没有实现IOrderedEnumerable ?

我想使用有序的枚举,并使用接口作为返回类型而不是具体类型。 我需要返回一组有序的对象。 但是,当使用IList实现时, 我无法返回IOrderedEnumerable ,因为IList不会inheritanceIOrderedEnumerable 。 在下面的示例中,我有一个带有系列存储库的视图模型,实现为List的系列对象,它们位于List ,并且是有序的。 我是一个访问器方法,我想返回一个系列的过滤集,其中只返回特定类型的系列对象,同时保持过滤元素之间的原始顺序。 /// /// Represents the view model for this module. /// public class ViewModel : AbstractViewModel { /// /// Gets the series repository. /// /// The series repository. public IList SeriesRepository { get; private set; } //… } //8<—————————– /// /// Gets the series of the specified […]