public Property this[string name]
{
get
{
if (_objPropertyCollection == null)
{
_objPropertyCollection = new Dictionary<string, Property>();
}
// An instance of the Property that will be returned
Property objProperty;
// If the PropertyBag already contains a property whose name matches
// the property required, ...
if (_objPropertyCollection.ContainsKey(name))
{
// ... then return the pre-existing property
objProperty = _objPropertyCollection[name];
}
else
{
// ... otherwise, create a new Property with a matching name, and
// a null Value, and add it to the PropertyBag
objProperty = new Property(name, this);
_objPropertyCollection.Add(name, objProperty);
}
return objProperty;
}
}