electricessence / TypeScript.NET

A JavaScript-Friendly .NET Based TypeScript Library (Moved)
https://github.com/electricessence/TypeScript.NET-Core
Other
251 stars 36 forks source link

Enumerable Class #55

Closed lommez closed 7 years ago

lommez commented 7 years ago

I saw in d.ts that the Enumerable class doesn´t exist anymore. In it´s place should I use LinqEnumerable of FiniteEnumerable?

Thanks

electricessence commented 7 years ago

@lommez Not exactly... 1) LinqEnumerable is the actual class that does the work. But Enumerable is the module (static utility) that has methods like from().

electricessence commented 7 years ago

2) This allowed me to simplify the module's usage a bit while keeping its integrity.

So now you can:

var myResult = Enumerable(source).where(predicate).select(selector).toArray();
electricessence commented 7 years ago

Which before you would have to:

var myResult = Enumerable.from(source).where(predicate).select(selector).toArray();
electricessence commented 7 years ago

InfiniteEnumerable was an innovation I did to have a smaller interface for enumerations that don't end and that you shouldn't attempt to get a single result from. So I did my best to isolate methods that could process an endless enumerable into InfiniteEnumerable, then extend that to LinqEnumerable (aka FiniteEnumerable) so that LinqEnumerable has all the expected LINQ methods (and more).

lommez commented 7 years ago

Very good Thanks!