Table of Contents

Class DynamicAccessor

Namespace
Tlabs.Dynamic
Assembly
Tlabs.Core.dll

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

DynamicAccessor.Property

Properties

this[string]

Indexer to return DynamicAccessor.Property for name.

public DynamicAccessor.Property this[string name] { get; }

Parameters

name string

Property Value

DynamicAccessor.Property

TargetType

Accessor's target type.

public Type TargetType { get; }

Property Value

Type

Methods

Has(string)

Check if DynamicAccessor.Property for name exists.

public bool Has(string name)

Parameters

name string

Returns

bool

ToDictionary(object)

Returns a IDictionary to access all properties of target.

public IDictionary<string, object?> ToDictionary(object target)

Parameters

target object

Returns

IDictionary<string, object>

ToValueDictionary(object)

Returns a IDictionary to access all property values of target.

public IDictionary<string, object?> ToValueDictionary(object target)

Parameters

target object

Returns

IDictionary<string, object>

Remarks

Any changes to the values of the returned dictionary will not be reflected in the target object.