Table of Contents

Class PropertyBag

Namespace
NUnit.Framework.Internal
Assembly
nunit.framework.dll

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 class PropertyBag : IPropertyBag, IXmlNodeBuilder
Inheritance
PropertyBag
Implements
Inherited Members

Constructors

PropertyBag()

public PropertyBag()

Properties

this[string]

Gets or sets the list of _values for a particular key

public IList this[string key] { get; set; }

Parameters

key string

Property Value

IList

Keys

Gets a collection containing all the keys in the property set

public ICollection<string> Keys { get; }

Property Value

ICollection<string>

Methods

Add(string, object)

Adds a key/value pair to the property set

public void Add(string key, object value)

Parameters

key string

The key

value object

The value

AddToXml(XmlNode, bool)

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

public XmlNode AddToXml(XmlNode parentNode, bool recursive)

Parameters

parentNode XmlNode

The parent node.

recursive bool

Not used

Returns

XmlNode

ContainsKey(string)

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

public bool ContainsKey(string key)

Parameters

key string

The key to be checked

Returns

bool

True if their are _values present, otherwise false

Get(string)

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 object Get(string key)

Parameters

key string

Returns

object

Set(string, object)

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

public void Set(string key, object value)

Parameters

key string
value object

ToXml(bool)

Returns an XmlNode representating the current PropertyBag.

public XmlNode ToXml(bool recursive)

Parameters

recursive bool

Not used

Returns

XmlNode

An XmlNode representing the PropertyBag