DynamicObjectExtensions

public static class DynamicObjectExtensions;

Description

Dynamic property lookup for classes and structs.

This class uses reflection to dynamically lookup a class or struct property. To use it, include its namespace: P7.CanvasFlow.DynamicObjectExtensions.

Canvas Flow's Scale And Fade Background transition animator uses the GetField extension method to dynamically find the contentToScalePropertyName specified in the animator's inspector.

Properties
None
Methods
GetField<T> Get the class' field with the specified name and type using reflection.
GetValueField<T> Get the struct's field with the specified name and type using reflection.

GetField<T>

public static T GetField<T>(this Object obj, string fieldName) where T : class;

Parameters

Name Description
T The type of the field.
fieldName The name of the field.

Description

Get the class' field with the specified name and type using reflection.


GetValueField<T>

public static T? GetValueField<T>(this Object obj, string fieldName) where T : struct;

Parameters

Name Description
T The type of the field.
fieldName The name of the field.

Description

Get the struct's field with the specified name and type using reflection.