Class ConvertingPropertyAccessor<TPin, TObj>
Member Accessor implementation specialized on accessing properties (using set and get) where the type of the pin and the actual type of the field are different. The accessor performs the conversion operation specified when performing its set or get operations.
Inheritance
Implements
Inherited Members
Namespace: Fusee.Xirkit
Assembly: Fusee.Xirkit.dll
Syntax
public class ConvertingPropertyAccessor<TPin, TObj> : IMemberAccessor<TPin>
Type Parameters
Name | Description |
---|---|
TPin | The type of the pin. |
TObj | The type of the field. |
Constructors
ConvertingPropertyAccessor(PropertyInfo, Converter<TPin, TObj>, Converter<TObj, TPin>)
Initializes a new instance of the ConvertingPropertyAccessor<TPin, TObj> class.
Declaration
public ConvertingPropertyAccessor(PropertyInfo propertyInfo, Converter<TPin, TObj> p2o, Converter<TObj, TPin> o2p)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.PropertyInfo | propertyInfo | The field information. |
Converter<TPin, TObj> | p2o | The conversion operation to convert values from the pin type to the field type. |
Converter<TObj, TPin> | o2p | The inverse conversion operation (from field to pin). |
Methods
Get(Object)
Retrieves the value currently stored in the object o. his instance holds information about which property of o the value should be retrieved from and how to perform this retrieval.
Declaration
public TPin Get(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object from which the property identified with this instance's property accessor the value is to be retrieved from. |
Returns
Type | Description |
---|---|
TPin | The value currently stored in o's property. |
Set(Object, TPin)
Sets the specified value to the given object. This instance holds information about which property is to be filled with the value and how to perform this assignment.
Declaration
public void Set(object o, TPin val)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object on which the property identified with this instance's property accessor the given value is to be assigned to. |
TPin | val | The value that should be assigned. |