Skip to content
richardszalay edited this page May 20, 2011 · 1 revision

Convience method for creating IEnumerable sequences

global function toEnumerable(... args) : IObservable.<*>

toObservable can be considered to have the following overloads:

Signature Equivalent
function toEnumerable() Enumerable.empty()
function toEnumerable(enumerable : IEnumerable) enumerable
function toEnumerable(array : Array) Enumerable.fromArray(array)
function toEnumerable(proxy : Proxy) Enumerable.fromProxy(proxy)
function toEnumerable(value : *) Enumerable.value(value)

Examples

for each(var value : int in toEnumerable(5))
{
    trace(value);
}

// Trace output is:
// 5
for each(var value : int in toEnumerable([1, 2, 3, 4, 5]))
{
    trace(value);
}

// Trace output is:
// 1
// 2
// 3
// 4
// 5