Type Parameters

  • T

Hierarchy

Implemented by

Properties

isReadOnly: boolean

Gets a value indicating whether the ICollection is read-only.

length: number

Gets the number of elements contained in the ICollection.

Methods

  • Returns Iterator<T, any, undefined>

  • Adds an item to the ICollection.

    Parameters

    • item: T

      The object to add to the ICollection.

    Returns void

  • Returns true if any of the items match the predicate, otherwise false

    Parameters

    Returns boolean

    Example

    if (myEnumerable.any()) {
    // do something because the enumerable has elements
    }
    let myEnumerable = new ArrayEnumerable([1, 2, 3, 4]);
    if (myEnumerable.any((i) => i == 2)) {
    // the enumerable contains a '2'
    }
  • Copies the elements of the ICollection to an Array, starting at a particular Array index.

    Parameters

    • array: T[]

      The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.

    • arrayIndex: number

      The zero-based index in array at which copying begins.

    Returns void

  • Iterates over the enumerable and performs the callback on each item. Return false to break.

    Parameters

    • callback: ((value, index) => boolean | void)
        • (value, index): boolean | void
        • Parameters

          • value: T
          • index: number

          Returns boolean | void

    Returns void

  • Removes the first occurrence of a specific object from the ICollection.

    Parameters

    • item: T

    Returns boolean

  • Returns a single element only if there is one element in the enumerable

    Returns T

    Throws

    InvalidOperationException if there is not exactly one item in the enumerable

  • Returns a single element only if there is one element in the enumerable that matches the predicate

    Parameters

    Returns T

    Throws

    InvalidOperationException if there is not exactly one item in the enumerable that matches the predicate

  • Returns a single element only if there is one element in the enumerable. If there are no items in the enumerable, then null is returned

    Returns null | T

    Throws

    InvalidOperationException if there is not exactly one or zero items in the enumerable

  • Returns a single element only if there is one element in the enumerable that matches the predicate. If there are no items in the enumerable, then null is returned

    Parameters

    Returns null | T

    Throws

    InvalidOperationException if there is not exactly one or zero item in the enumerable that matches the predicate

  • Returns a dictionary based on the key and value selctors

    Type Parameters

    • TKey

    • TValue

    Parameters

    • keySelector: ((a) => TKey)
        • (a): TKey
        • Parameters

          • a: T

          Returns TKey

    • valueSelector: ((a) => TValue)
        • (a): TValue
        • Parameters

          • a: T

          Returns TValue

    Returns IDictionary<TKey, TValue>

Generated using TypeDoc