Class DynamicAccessor
Class to provide property access to instances of a dynamically provided (typically generated) type.
public class DynamicAccessor
- Inheritance
-
DynamicAccessor
- Inherited Members
- Extension Methods
Constructors
DynamicAccessor(Type)
Ctor from targetType
.
public DynamicAccessor(Type targetType)
Parameters
targetType
Type
Fields
NILProperty
Nop property returned for non existing members.
public static readonly DynamicAccessor.Property NILProperty
Field Value
Properties
this[string]
Indexer to return DynamicAccessor.Property for name
.
public DynamicAccessor.Property this[string name] { get; }
Parameters
name
string
Property Value
TargetType
Accessor's target type.
public Type TargetType { get; }
Property Value
Methods
Has(string)
Check if DynamicAccessor.Property for name
exists.
public bool Has(string name)
Parameters
name
string
Returns
ToDictionary(object)
Returns a IDictionary
to access all properties of target
.
public IDictionary<string, object?> ToDictionary(object target)
Parameters
target
object
Returns
ToValueDictionary(object)
Returns a IDictionary
to access all property values of target
.
public IDictionary<string, object?> ToValueDictionary(object target)
Parameters
target
object
Returns
Remarks
Any changes to the values of the returned dictionary will not be reflected in the target
object.