Defines methods to manipulate generic collections.

interface ICollection<T> {
    constructor: any;
    get Count(): number;
    get IsReadOnly(): boolean;
    Add(item: T | JsType<T>): void;
    Cast<T1, T2>(this: T2, type: TypeRef<T1>): T1;
    Clear(): void;
    Contains(item: T | JsType<T>): boolean;
    Remove(item: T | JsType<T>): boolean;
    TryCast<T1, T2>(this: T2, type: TypeRef<T1>): null | T1;
    [iterator](): Iterator<JsType<T>, any, undefined>;
}

Type Parameters

  • T

Hierarchy (view full)

Constructors

constructor

Accessors

Methods

  • Casts this object to the specified type. Throws error on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns T1

  • Casts this object to the specified type. Returns null on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns null | T1