documentationfor yFiles for HTML 2.6

ListEnumerable<T>

Wraps a simple IEnumerable<T> into a IListEnumerable<T>.

Inheritance Hierarchy
ListEnumerable
Implemented Interfaces

Remarks

This implementation is optimized for IList<T> and ICollection<T>, as well as Array<Object> IEnumerable<T>s.

This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.

It is possible to specify an Array or to use the native 'iterable' protocol, iterators, or generators to populate the ListEnumerable<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) {
  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
}// 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 will be populated only once, immediately after creation when created with from, and thus the generator will only be executed once.

Type Parameters

T
The type of the enumerable.

Type Details

yfiles module
core
yfiles-umd modules
All modules
Legacy UMD name
yfiles.collections.ListEnumerable

Constructors

Properties

Methods