Class PropertySet<TProperty, TValue>
A generic property set that handles storing and creating a look up for quick access.
Inheritance
PropertySet<TProperty, TValue>
Implements
Inherited Members
Namespace: TinnyStudios.AIUtility.Core.Properties
Assembly: UtilityAIFramework.dll
Syntax
public class PropertySet<TProperty, TValue> : IPropertySet where TProperty : IProperty<TValue>, new()
Type Parameters
Name | Description |
---|---|
TProperty | The concrete property such as FloatProperty |
TValue | A value such as Single |
Fields
Properties
Declaration
public List<TProperty> Properties
Field Value
Type | Description |
---|---|
List<TProperty> |
PropertyLookUp
Declaration
public Dictionary<string, TProperty> PropertyLookUp
Field Value
Type | Description |
---|---|
Dictionary<String, TProperty> |
Methods
Initialize()
Initialize the LookUp table from a list of properties.
Declaration
public void Initialize()
SetValue(String, TValue)
Set the value of a property name. It will try to add if it doesn't exist.
Declaration
public void SetValue(string propertyName, TValue value)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Name of property to add. |
TValue | value | Starting value of the property |
TryAdd(String, TValue)
Try to add a new property name with a value.
Declaration
public bool TryAdd(string propertyName, TValue value)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | |
TValue | value |
Returns
Type | Description |
---|---|
Boolean | True if the look up doesn't contain the property name, False if it does. |
TryGet(String, out TValue)
Try to get the value of a property.
Declaration
public bool TryGet(string propertyName, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Name of property |
TValue | value | The value of the property |
Returns
Type | Description |
---|---|
Boolean | True if successful |
TryGetProperty(String, out TProperty)
Tries to get the property class. This isn't not suggested to use, TryGet(String, out TValue)
Declaration
public bool TryGetProperty(string propertyName, out TProperty property)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Name of property |
TProperty | property | The class containing the property value and name |
Returns
Type | Description |
---|---|
Boolean | True if successful |