PropertyBag Class

Definition

Represents a property bag.

public sealed class PropertyBag
type PropertyBag = class
Public NotInheritable Class PropertyBag
Inheritance
PropertyBag

Constructors

Name Description
PropertyBag()

Initializes a new instance of the PropertyBag class.

PropertyBag(IEnumerable<IProperty>)

Initializes a new instance of the PropertyBag class.

PropertyBag(IProperty[])

Initializes a new instance of the PropertyBag class.

Properties

Name Description
Count

Gets the number of properties in the bag.

Methods

Name Description
Add(IProperty)

Adds a property to the bag.

Any<TProperty>()

Determines whether the bag contains a property of the specified type.

AsEnumerable()

Returns an enumerable that iterates through the collection.

FirstOrDefault<TProperty>()

Returns the first property of the TProperty type, or default if none is found. Unlike SingleOrDefault<TProperty>(), this method does not throw when multiple properties of the same type are present — it simply returns the first one encountered.

GetEnumerator()

Returns an enumerator that iterates through the collection.

OfType<TProperty>()

Gets the properties of the TProperty type.

Single<TProperty>()

Returns the only property of the TProperty type, and throws an exception if there is not exactly one element.

SingleOrDefault<TProperty>()

Returns the only property of the TProperty type, or default, and throws an exception if there is more than one element.

Applies to