Show / Hide Table of Contents

    Interface IConfigurationCollection<TElement>

    Represents a collection of values stored in a property. Use the interface for properties representing an arbitrary number of the same kind of object identified by index.

    Inherited Members
    System.Collections.Generic.IList<TElement>.IndexOf(TElement)
    System.Collections.Generic.IList<TElement>.Insert(System.Int32, TElement)
    System.Collections.Generic.IList<TElement>.RemoveAt(System.Int32)
    System.Collections.Generic.IList<TElement>.Item[System.Int32]
    System.Collections.Generic.ICollection<TElement>.Add(TElement)
    System.Collections.Generic.ICollection<TElement>.Clear()
    System.Collections.Generic.ICollection<TElement>.Contains(TElement)
    System.Collections.Generic.ICollection<TElement>.CopyTo(TElement[], System.Int32)
    System.Collections.Generic.ICollection<TElement>.Remove(TElement)
    System.Collections.Generic.ICollection<TElement>.Count
    System.Collections.Generic.ICollection<TElement>.IsReadOnly
    System.Collections.Generic.IEnumerable<TElement>.GetEnumerator()
    System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged
    IConfigurationObject.IsDirty
    IConfigurationObject.Delete()
    IConfigurationObject.Load()
    IConfigurationObject.Save()
    System.IDisposable.Dispose()
    System.ComponentModel.INotifyPropertyChanged.PropertyChanged
    Namespace: OpenCollar.Extensions.Configuration
    Assembly: OpenCollar.Extensions.Configuration.dll
    Syntax
    public interface IConfigurationCollection<TElement> : IList<TElement>, ICollection<TElement>, IEnumerable<TElement>, IEnumerable, INotifyCollectionChanged, IConfigurationObject, IDisposable, INotifyPropertyChanged
    Type Parameters
    Name Description
    TElement

    The type of the collection element. This must be nullable if the type is a reference type and can be null.

    Remarks

    The following UML has been generated directly from the source code using Jebbs PlantUML .

    Examples

    In the example below a property on an interface is defined as containing an arbitray number of strings.

    IConfigurationCollection<string> Names
    {
    get; set;
    }

    If the configuration is specified in a JSON configuration file it would look something like this:

    {
    "Names": [
        "Value 1",
        "Value 2",
        "Value 3"
    ]
    }

    Methods

    | Improve this Doc View Source

    AddCopy(TElement)

    Adds a new value with the key specified, copying the properties and elements from the value give, returning the new value.

    Declaration
    TElement AddCopy(TElement value)
    Parameters
    Type Name Description
    TElement value

    The value to copy (must be compatible with the type or interface specified by TElement).

    Returns
    Type Description
    TElement

    The newly added element. If this element is derived from IConfigurationObject, IConfigurationCollection<TElement> or IConfigurationDictionary<TElement>, and the object given was not created by this library, then a new object will be created and they properties and elements in the object given will be copied.

    Remarks

    Used to add objects and collections that have been constructed externally using alternate implementations.

    | Improve this Doc View Source

    AddNew()

    Adds a new value with the key specified, returning the newly created object.

    Declaration
    TElement AddNew()
    Returns
    Type Description
    TElement

    The newly added element.

    Remarks

    This allows instances of the internal implementation of objects to be created and added to the collection, and returned to be populated.

    See Also

    System.Collections.Generic.IList<T>
    System.Collections.Specialized.INotifyCollectionChanged
    IConfigurationObject
    • Improve this Doc
    • View Source
    Back to top
    Copyright © 2019-2020 Jonathan Evans
    Version: 0.2.232