Show / Hide Table of Contents

Class XmlDictionary

A string dictionary that supports data-binding and can be XML serialized.

Inheritance
Object
XmlDictionary
Implements
ICloneable<XmlDictionary>
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 key already exists in the dictionary.

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

true if the key was found.

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

true if the value was found.

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 key.

Exceptions
Type Condition
KeyNotFoundException

key was not found in the collection.

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

true if one or more elements were removed; otherwise, false.

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.

Implements

ICloneable<T>

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher