documentationfor yFiles for HTML 3.0.0.2

IListEnumerable<T>

An extension to the IEnumerable<T> interface that allows for indexed access and retrieval of the element count.

Remarks

This interface is like a rudimentary read-only IList<T>.

It's a convertible type that can be used in the following alternative ways in parameter lists, parameter objects or setters when annotated as such:

It is possible to specify an Array or to use the native 'iterable' protocol , iterators, or generators to populate the IListEnumerable<T> instance:

// Array
object.property = [item1, item2]

// Iterables
object.property = new Set([item1, item2])
object.property = new Map([
  [key1, item1],
  [key2, item2],
]).entries()

// Generators
function* generator(i: number) {
  yield i
  yield i + 10
}

// via the iterator protocol (with invocation)
object.property = generator(10)

// via the generator function (will be executed immediately to populate the collection)
object.property = function* generateValues() {
  yield 1
  yield 2
}

Note that when using native iterables, in contrast to IEnumerable<T> created with from which will reevaluate upon re-enumeration, the list-enumerable will be populated only once, when when created with from, and thus the generator will only be executed once.

Type Parameters

T
The type of the contained elements.

Type Details

yFiles module
core

See Also

Properties

Methods

Constants

Static Methods