Linq statement for an infinite sequence of successive halves
问题 Given a starting number, imagine an infinite sequence of its successive halves. 1, 0.5, 0.25, 0.125, ... (Ignore any numerical instabilities inherent in double .) Can this be done in a single expression without writing any custom extension methods or generator methods? 回答1: I don't know of a single-expression way but I found this clever generator code here: http://csharpindepth.com/articles/Chapter11/StreamingAndIterators.aspx public static IEnumerable<TSource> Generate<TSource>(TSource start