Class DelegateProperty<TContainer, TValue>
Represents a value property.
Inherited Members
Namespace: Unity.Properties
Syntax
public class DelegateProperty<TContainer, TValue> : Property<TContainer, TValue>, IProperty<TContainer>, IProperty, IPropertyAccept<TContainer>, IAttributes
Type Parameters
Name | Description |
---|---|
TContainer | The container type this property will access data on. |
TValue | The value type for this property. |
Remarks
A DelegateProperty<TContainer, TValue> is the default way to construct properties.
Constructors
DelegateProperty(String, PropertyGetter<TContainer, TValue>, PropertySetter<TContainer, TValue>)
Initializes a new instance of the DelegateProperty<TContainer, TValue> class.
Declaration
public DelegateProperty(string name, PropertyGetter<TContainer, TValue> getter, PropertySetter<TContainer, TValue> setter = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | The property name. |
PropertyGetter<TContainer, TValue> | getter | The delegate to use when accessing the property value. |
PropertySetter<TContainer, TValue> | setter | The delegate to use when setting the property value. |
Properties
IsReadOnly
Gets a value indicating whether the property is read-only or not.
Declaration
public override bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Name
Gets the name of the property.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
Methods
GetValue(ref TContainer)
Returns the property value of a specified container.
Declaration
public override TValue GetValue(ref TContainer container)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
Returns
Type | Description |
---|---|
TValue | The property value of the given container. |
Overrides
SetValue(ref TContainer, TValue)
Sets the property value of a specified container.
Declaration
public override void SetValue(ref TContainer container, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be set. |
TValue | value | The new property value. |