Returns an empty IEnumerable<T>
that has the specified type argument.
An empty IEnumerable<T>
whose type argument is T.
Enumerable.Empty().Concat([1,2,3]).ToArray()
// [1, 2, 3]
Generates an IEnumerable<T>
from generator, and objects which implements enumerator.
Source from which an IEnumerable<T>
is created.
Returns the source typed as IEnumerable<T>
.
let naturalNumbers = Enumerable.From(function* () {
let i = 0;
while (true) yield i++;
})
naturalNumbers.Take(10).ToArray()
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Generates a sequence of integral numbers within a specified range.
The value of the first integer in the sequence.
The number of sequential integers to generate.
An IEnumerable<number>
that contains a range of sequential integral numbers.
let smallNaturalNumbers = Enumerable.Range(0,10)
smallNaturalNumbers.ToArray()
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Generates a sequence that contains one repeated value.
The value to be repeated.
The number of times to repeat the value in the generated sequence.
An IEnumerable<T>
that contains a repeated value.
let numbers = Enumerable.Repeat(5,10)
numbers.ToArray()
// [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
Set new method for querying IEnumerable objects.
Name of the new method.
Generator function or normal function for querying IEnumerable objects.
Enumerable.setMethod("EvenElements", function*() {
let ind = 0;
for (let t of this)
if (ind++%2 === 0) yield t;
});
["a","b","c","d"].EvenElements().ToArray();
Generated using TypeDoc
Proved a methods to create
IEnumerable<T>
and to define methods onIEnumerable<T>
.