Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Sealed class: RT.Servers.NameValuesCollection<TValue>

Summary

Encapsulates a collection that maps keys to collections of values. Provides the ability to cheaply make the collection fully read-only. Provides a sort of auto-vivification for convenience.

Generic type parameters

TValueThe type of the values to be associated with each key.

Example

// initially myNameValue does not contain the key "fruits"
int c = myNameValues["fruits"].Count;  // c == 0
myNameValues["fruits"].Add("orange");
// myNameValue now contains the key "fruits", with one value associated.

Constructors

Creates an empty collection.

Instance methods

void
Add(KeyValuePair<string, ValuesCollection<TValue>> item)
Adds the specified key and value collection.
void
Add(string key, ValuesCollection<TValue> value)
Adds all items from the specified value collection, associating them with the specified key. Throws an exception if the specified key already has items associated with it.
NameValuesCollection<TValue> Returns a read-only version of this collection. The returned collection could be the same as this one, if it's already read-only, or it could be a wrapper created around the items in this collection. If the original collection gets modified, the read-only version will reflect the changes instantly.
void Clears all items from this collection.
bool
Contains(KeyValuePair<string, ValuesCollection<TValue>> item)
Not implemented.
bool
ContainsKey(string key)
Returns true iff this collection has at least one value associated with the specified key.
void
CopyTo(KeyValuePair<string, ValuesCollection<TValue>>[] array, int arrayIndex)
  • Implements: ICollection<KeyValuePair<string, ValuesCollection<TValue>>>.CopyTo(KeyValuePair<string, ValuesCollection<TValue>>[], int)
Copies all key/value-collection pairs to the specified array.
IEnumerator<KeyValuePair<string, ValuesCollection<TValue>>>
  • Implements: IEnumerable<KeyValuePair<string, ValuesCollection<TValue>>>.GetEnumerator()
Gets an enumerator to iterate over all key/value-collection pairs in this collection.
bool
Remove(string key)
Removes all items associated with the specified key. Returns true iff any items were removed.
bool
Remove(KeyValuePair<string, ValuesCollection<TValue>> item)
Not implemented.
bool
TryGetValue(string key, out ValuesCollection<TValue> value)
Gets the collection of values associated with the specified key, or an empty collection if no such items exist. Returns true iff any items are associated with the key.

Instance properties

int Gets the number of keys in this collection which have at least one value associated with them.
bool
  • Implements: ICollection<KeyValuePair<string, ValuesCollection<TValue>>>.IsReadOnly
Returns true iff this collection is read-only (cannot be modified).
ValuesCollection<TValue>
this[string key]
Gets or sets a collection of values associated with the specified key.
ICollection<string> Gets a collection of the keys that have at least one value associated with them. This method is not particularly cheap.
ICollection<ValuesCollection<TValue>> Gets the collection of all value collections. This method is not particularly cheap.