Class ContainerPropertyBag<TContainer>
Base class for implementing a static property bag for a specified container type. This is an abstract class.
Inherited Members
Namespace: Unity.Properties
Syntax
public abstract class ContainerPropertyBag<TContainer> : PropertyBag<TContainer>, IPropertyBag<TContainer>, IPropertyBag, IPropertyBagRegister, IConstructor<TContainer>, IConstructor, INamedProperties<TContainer>
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
Remarks
A ContainerPropertyBag<TContainer> is used to describe and traverse the properties for a specified TContainer
type.
In order for properties to operate on a type, a ContainerPropertyBag<TContainer> must exist and be pre-registered for that type.
NOTE In editor use cases property bags can be generated dynamically through reflection. (see Unity.Properties.Reflection)
Methods
AddProperty<TValue>(Property<TContainer, TValue>)
Adds a Property<TContainer, TValue> to the property bag.
Declaration
protected void AddProperty<TValue>(Property<TContainer, TValue> property)
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TValue> | property | The Property<TContainer, TValue> to add. |
Type Parameters
Name | Description |
---|---|
TValue | The value type for the given property. |
GetProperties()
Implement this method to return a PropertyCollection<TContainer> that can enumerate through all properties for the TContainer
.
Declaration
public override PropertyCollection<TContainer> GetProperties()
Returns
Type | Description |
---|---|
PropertyCollection<TContainer> | A PropertyCollection<TContainer> structure which can enumerate each property. |
Overrides
GetProperties(ref TContainer)
Implement this method to return a PropertyCollection<TContainer> that can enumerate through all properties for the TContainer
.
Declaration
public override PropertyCollection<TContainer> GetProperties(ref TContainer container)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container hosting the data. |
Returns
Type | Description |
---|---|
PropertyCollection<TContainer> | A PropertyCollection<TContainer> structure which can enumerate each property. |
Overrides
TryGetProperty(ref TContainer, String, out IProperty<TContainer>)
Gets the property associated with the specified name.
Declaration
public bool TryGetProperty(ref TContainer container, string name, out IProperty<TContainer> property)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container hosting the data. |
String | name | The name of the property to get. |
IProperty<TContainer> | property | When this method returns, contains the property associated with the specified name, if the name is found; otherwise, null. |
Returns
Type | Description |
---|---|
Boolean | true if the INamedProperties<TContainer> contains a property with the specified name; otherwise, false. |