Class XmlDictionary
A string dictionary that supports data-binding and can be XML serialized.
Implements
Namespace: NanoByte.Common.Collections
Assembly: NanoByte.Common.dll
Syntax
public class XmlDictionary : BindingList<XmlDictionaryEntry>, ICloneable<XmlDictionary>
Constructors
XmlDictionary()
Declaration
public XmlDictionary()
Methods
Add(String, String)
Adds a new value and links it to a key
Declaration
public void Add(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key object |
System.String | value | The value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The |
Clone()
Creates a deep copy of this XmlDictionary (elements are cloned).
Declaration
public virtual XmlDictionary Clone()
Returns
Type | Description |
---|---|
XmlDictionary | The cloned XmlDictionary. |
ContainsKey(String)
Checks whether this collection contains a certain key.
Declaration
public bool ContainsKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to look for. |
Returns
Type | Description |
---|---|
Boolean |
|
ContainsValue(String)
Checks whether this collection contains a certain value.
Declaration
public bool ContainsValue(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to look for. |
Returns
Type | Description |
---|---|
Boolean |
|
GetValue(String)
Returns the value associated to a specific key.
Declaration
public string GetValue(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to look for. |
Returns
Type | Description |
---|---|
System.String | The value associated to |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException |
|
InsertItem(Int32, XmlDictionaryEntry)
Declaration
protected override void InsertItem(int index, XmlDictionaryEntry item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | |
XmlDictionaryEntry | item |
Remove(String)
Removes all values assigned to this key.
Declaration
public bool Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to look for. |
Returns
Type | Description |
---|---|
Boolean |
|
Sort()
Sorts all entries alphabetically by their key.
Declaration
public void Sort()
ToDictionary()
Convert this XmlDictionary to a Dictionary<TKey,TValue> for better lookup-performance.
Declaration
public IDictionary<string, string> ToDictionary()
Returns
Type | Description |
---|---|
IDictionary<System.String, System.String> | A dictionary containing the same data as this collection. |