<PackageReference Include="NUnit" Version="4.2.2" />

PropertyBag

A PropertyBag represents a collection of name value pairs that allows duplicate entries with the same key. Methods are provided for adding a new pair as well as for setting a key to a single value. All keys are strings but values may be of any type. Null values are not permitted, since a null entry represents the absence of the key.
public IList this[string key] { get; set; }

Gets or sets the list of values for a particular key

public ICollection<string> Keys { get; }

Gets a collection containing all the keys in the property set

public PropertyBag()

public void Add(string key, object value)

Adds a key/value pair to the property set

public TNode AddToXml(TNode parentNode, bool recursive)

Returns an XmlNode representing the PropertyBag after adding it as a child of the supplied parent node.

public bool ContainsKey(string key)

Gets a flag indicating whether the specified key has any entries in the property set.

public object Get(string key)

Gets a single value for a key, using the first one if multiple values are present and returning null if the value is not found.

public void Set(string key, object value)

Sets the value for a key, removing any other values that are already in the property set.

public TNode ToXml(bool recursive)

Returns an XmlNode representing the current PropertyBag.

public bool TryGet(string key, out IList values)

Tries to retrieve list of values.