【发布时间】:2013-10-15 08:40:52
【问题描述】:
例如,返回Task 对象的方法以“Async”为后缀。或者使用IAsyncResult 的方法以“Begin”和“End”为前缀。
对于返回IEnumerable<T> 的方法有什么约定吗?感觉应该有,但我在.NET库中没有看到任何迭代器方法。
如果答案是“否”,请随时提出一些建议作为答案的一部分。
【问题讨论】:
-
我可以想到两种情况,旧的数组返回方法在 .Net 4.0 中添加了新的
IEnumerable-returning 版本:File.ReadAllLines()→ReadLines()和Directory.GetFiles()→ @987654328 @.
标签: .net iterator naming-conventions yield-return