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
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 SourceAddCopy(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 |
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.
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.