Class CompositeReadingCollection
A read-only collection of reading values that is a composition of other reading collections.
public class CompositeReadingCollection : IReadingCollection, IReadOnlyDictionary<string, IReadingValue>, IReadOnlyCollection<KeyValuePair<string, IReadingValue>>, IEnumerable<KeyValuePair<string, IReadingValue>>, IEnumerable
- Inheritance
-
CompositeReadingCollection
- Implements
- Inherited Members
- Extension Methods
Constructors
CompositeReadingCollection(IReadOnlyList<IReadingCollection>)
Initializes a new instance of the CompositeReadingCollection class.
public CompositeReadingCollection(IReadOnlyList<IReadingCollection> readingCollections)
Parameters
readingCollections
IReadOnlyList<IReadingCollection>The list of reading collections. This instance will retain a reference to this collection, so it must not change.
Exceptions
- ArgumentNullException
readingCollections
is null.
Properties
Count
Gets the number of elements in the collection.
public int Count { get; }
Property Value
- int
The number of elements in the collection.
this[string]
Gets the element that has the specified key in the read-only dictionary.
public IReadingValue this[string key] { get; }
Parameters
key
stringThe key to locate.
Property Value
- IReadingValue
The element that has the specified key in the read-only dictionary.
Exceptions
- ArgumentNullException
key
is null.- KeyNotFoundException
The property is retrieved and
key
is not found.
Keys
Gets an enumerable collection that contains the keys in the read-only dictionary.
public IEnumerable<string> Keys { get; }
Property Value
- IEnumerable<string>
An enumerable collection that contains the keys in the read-only dictionary.
ReadingCollections
Gets the list of reading collections that make up this composite collection.
public IReadOnlyList<IReadingCollection> ReadingCollections { get; }
Property Value
Values
Gets an enumerable collection that contains the values in the read-only dictionary.
public IEnumerable<IReadingValue> Values { get; }
Property Value
- IEnumerable<IReadingValue>
An enumerable collection that contains the values in the read-only dictionary.
Methods
ContainsKey(string)
Determines whether the read-only dictionary contains an element that has the specified key.
public bool ContainsKey(string key)
Parameters
key
stringThe key to locate.
Returns
- bool
true if the read-only dictionary contains an element that has the specified key; otherwise, false.
Exceptions
- ArgumentNullException
key
is null.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<KeyValuePair<string, IReadingValue>> GetEnumerator()
Returns
- IEnumerator<KeyValuePair<string, IReadingValue>>
An enumerator that can be used to iterate through the collection.
TryGetValue(string, out IReadingValue)
Gets the value that is associated with the specified key.
public bool TryGetValue(string key, out IReadingValue value)
Parameters
key
stringThe key to locate.
value
IReadingValueWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the
value
parameter. This parameter is passed uninitialized.
Returns
- bool
true if the object that implements the IReadOnlyDictionary<TKey, TValue> interface contains an element that has the specified key; otherwise, false.
Exceptions
- ArgumentNullException
key
is null.