c# - 为什么 IEnumerable<T> 派生自 IEnumerable?

标签 c# .net ienumerable

<分区>

重复:

Why IEnumerable<T> inherits from IEnumerable?


看起来 IEnumerableICollectionIList 和它们的通用等价物在不同的分支中。

最佳答案

这样做是为了保证所有知道如何处理 IEnumerable 的旧方法和代码都可以与您的集合一起使用。

实现 IEnumerable<T>隐式意味着你实现 IEnumerable .

分支是指命名空间吗?

关于c# - 为什么 IEnumerable<T> 派生自 IEnumerable?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1174569/

相关文章:

C# Linq 到 SQL :cannot add an entity that already exists

c# - ASP.NET MVC 将 ActionLink 中的 ID 传递给 Controller

c# - WPF 中的 Visual Studio 样式撤消/重做按钮

c# - MySQL 查询中的输入字符串格式不正确

c# - 将 IEnumerable<Class> 转换为 List<string>

c# - 在 Windows Phone 8.1 Universal Store App 中触发警报?

c# - 绘制海量数据图表

c# - 使用 EntityFramework 和 .NET Native 时出现 PlatformNotSupportedException

c# - 将存储过程的结果作为 IEnumerable 返回

c# - 提取 IEnumerable<T> 中其键值等于 IEnumerable<U> 中的键值之一的项目