Class StringKeyStore
Represents a collection of string keys associated with multiple string values.
public class StringKeyStore : IDictionary<string, string[]>, ICollection<KeyValuePair<string, string[]>>, IEnumerable<KeyValuePair<string, string[]>>, IEnumerable
- Inheritance
-
StringKeyStore
- Implements
- Derived
- Inherited Members
Constructors
- StringKeyStore()
Initializes a new instance of the StringKeyStore class,
- StringKeyStore(IEqualityComparer<string>)
Initializes a new instance of the StringKeyStore class with a specified comparer.
- StringKeyStore(IEqualityComparer<string>, IDictionary<string, string[]>?)
Initializes a new instance of the StringKeyStore class,
Properties
- Comparer
Gets the IEqualityComparer<T> used to compare keys in this StringKeyStore.
- Count
Gets the number of key-value pairs in the StringKeyStore.
- IsReadOnly
Gets a value indicating whether the StringKeyStore is read-only.
- this[string]
Gets or sets the array of values associated with the specified key. Returns
null
if the key does not exist in the store.
- Keys
Gets the collection of keys in the StringKeyStore.
- Values
Gets the collection of values in the StringKeyStore as arrays. Each key may have multiple associated values.
Methods
- Add(KeyValuePair<string, string[]>)
Adds a key-value pair to the StringKeyStore.
- Add(string, IEnumerable<string>)
Adds a collection of values associated with the specified key.
- Add(string, string)
Adds a single value associated with the specified key.
- Add(string, string[])
Adds an array of values associated with the specified key.
- AddRange(IEnumerable<KeyValuePair<string, string[]>>)
Adds the elements of the specified collection to the end of this collection.
- AddRange(IEnumerable<KeyValuePair<string, string?>>)
Adds the elements of the specified collection to the end of this collection.
- AsDictionary()
Copies the contents of this StringKeyStore into an Dictionary<TKey, TValue>.
- AsNameValueCollection()
Copies the contents of this StringKeyStore into an NameValueCollection, with values separated with an comma (,).
- Clear()
Removes all key-value pairs from the StringKeyStore. Throws an exception if the store is read-only.
- ContainsKey(string)
Determines whether the StringKeyStore contains a specific key.
- FromCookieString(string)
Creates a new instance of the StringKeyStore from a cookie string. The query string should be in the format of "key1=value1; key2=value2".
- FromNameValueCollection(NameValueCollection)
Creates a new instance of the StringKeyStore from a NameValueCollection.
- FromQueryString(string)
Creates a new instance of the StringKeyStore from a query string. The query string should be in the format of "key1=value1&key2=value2".
- GetValue(string)
Retrieves the last value associated with the specified key. Returns
null
if the key does not exist.
- GetValues(string)
Retrieves all values associated with the specified key. Returns an empty array if the key does not exist.
- ImportCookieString(string)
Imports key-value pairs from a cookie string into the StringKeyStore. The query string should be in the format of "key1=value1; key2=value2".
- ImportNameValueCollection(NameValueCollection)
Imports key-value pairs from a NameValueCollection into the StringKeyStore. Each key can have multiple associated values.
- ImportQueryString(string)
Imports key-value pairs from a query string into the StringKeyStore. The query string should be in the format of "key1=value1&key2=value2".
- MakeReadOnly()
Marks the StringKeyStore as read-only, preventing further modifications.
- Remove(string)
Removes the value associated with the specified key from the StringKeyStore. Throws an exception if the store is read-only.
- Set(KeyValuePair<string, string[]>)
Sets the value associated with the specified key, replacing any existing values.
- Set(string, IEnumerable<string>)
Sets the collection of values associated with the specified key, replacing any existing values.
- Set(string, string)
Sets the value associated with the specified key, replacing any existing values.
- SetRange(IEnumerable<KeyValuePair<string, string[]>>)
Sets the elements of the specified collection, replacing existing values.
- TryGetValue(string, out string[])
Tries to get the array of values associated with the specified key.