by buddydvd · 15y ago · 0 comments
Enumerable
.Range(0, 1000000000000)
.Take(10)
.ToArray()
Output: 0,1,2,3,4,5,6,7,8,9Streams seems to be a proper subset of the things you can do with linqjs. Sometimes MSFT can do cool things too, it just doesn't always get picked up :)
I can think of a few fun uses (such using them as creative replacements for looping constructs), but I'm struggling to find a problem that is most easily solvable with these.
Enumerable
.Generate((function() {
var i = 0;
return function() {
return i++;
};
})())
.Take(10)
.ToArray()
Output: 0,1,2,3,4,5,6,7,8,9