Class ChainedMemberAccessor<TPin, TObj>
Class used inside Xirkit to access (read and write) nested members that are referenced by a chain of properties/fields separated by the object-access operator '.' (dot).
Inheritance
Implements
Inherited Members
Namespace: Fusee.Xirkit
Assembly: Fusee.Xirkit.dll
Syntax
public class ChainedMemberAccessor<TPin, TObj> : IMemberAccessor<TPin>
Type Parameters
Name | Description |
---|---|
TPin | The type of the pin (the type to the outside world). |
TObj | The type of the object referenced by the innermost member of the access chain. |
Constructors
ChainedMemberAccessor(MemberInfo[], Converter<TPin, TObj>, Converter<TObj, TPin>)
Initializes a new instance of the ChainedMemberAccessor<TPin, TObj> class.
Declaration
public ChainedMemberAccessor(MemberInfo[] miList, Converter<TPin, TObj> p2o, Converter<TObj, TPin> o2p)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MemberInfo[] | miList | A list of member info objects (sorted from outermost to innermost member along the access chain). |
Converter<TPin, TObj> | p2o | A converter converting from the pin type to and from the original type accessed by the pin. |
Converter<TObj, TPin> | o2p | A converter converting from the innermost type referenced by access chain to the outside pin type. |
Methods
Get(Object)
Retrieves the value of the innermost member along the access chain from the specified object.
Declaration
public TPin Get(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to retrieve a value from. |
Returns
Type | Description |
---|---|
TPin | The value contained in the given object at the end of the access chain starting in o. |
Set(Object, TPin)
Assigns the value given in val to the object accessed by this member accessor.
Declaration
public void Set(object o, TPin val)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to which the access chain belongs to. |
TPin | val | The value to be written to the end of the access chain starting in o. |