Unosquare
    Show / Hide Table of Contents

    Class ComponentCollection<T>

    Implements a collection of components.

    Each component in the collection may be given a unique name for later retrieval.

    Inheritance
    Object
    ComponentCollection<T>
    DisposableComponentCollection<T>
    Implements
    IComponentCollection<T>
    IReadOnlyList<T>
    Namespace: EmbedIO.Utilities
    Syntax
    public class ComponentCollection<T> : ConfiguredObject, IComponentCollection<T>, IReadOnlyList<T>
    Type Parameters
    Name Description
    T

    The type of components in the collection.

    Properties

    Count

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32

    Item[Int32]

    Declaration
    public T this[int index] { get; }
    Parameters
    Type Name Description
    Int32 index
    Property Value
    Type Description
    T

    Item[String]

    Gets the component with the specified name.

    Declaration
    public T this[string key] { get; }
    Parameters
    Type Name Description
    String key
    Property Value
    Type Description
    T

    The component.

    Named

    Gets an interface representing the named components.

    Declaration
    public IReadOnlyDictionary<string, T> Named { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<String, T>

    The named components.

    WithSafeNames

    Gets an interface representing all components associated with safe names.

    The safe name of a component is never null. If a component's unique name if null, its safe name will be some non-null string somehow identifying it.

    Note that safe names are not necessarily unique.

    Declaration
    public IReadOnlyList<(string SafeName, T Component)> WithSafeNames { get; }
    Property Value
    Type Description
    IReadOnlyList<ValueTuple<String, T>>

    A list of s, each containing a safe name and a component.

    Methods

    Add(String, T)

    Adds a component to the collection, giving it the specified name if it is not null.

    Declaration
    public void Add(string name, T component)
    Parameters
    Type Name Description
    String name

    The name given to the module, or null.

    T component

    The component.

    GetEnumerator()

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    Lock()

    Locks the collection, preventing further additions.

    Declaration
    public void Lock()

    Implements

    IComponentCollection<T>
    IReadOnlyList<>

    See Also

    IComponentCollection<T>

    Comments

    Back to top Copyright © 2017-2019 Unosquare