Table of Contents

Class RecursivePropertyAccessor

Namespace
CMS.Plugin.FlowManagement.Abstractions.FlowBusiness
Assembly
CMS.Plugin.FlowManagement.Abstractions.dll

递归获取多级嵌套属性的值

public class RecursivePropertyAccessor
Inheritance
RecursivePropertyAccessor
Inherited Members

Methods

GetNthElement(object, int)

Gets the NTH element.

public static object GetNthElement(object obj, int n)

Parameters

obj object

The object.

n int

The n.

Returns

object

GetPropertyValue(object, string, int?)

Gets the property value.

public static object GetPropertyValue(object source, string propertyPath, int? dataIndex = null)

Parameters

source object

The source.

propertyPath string

The property path.

dataIndex int?

Returns

object

Exceptions

ArgumentNullException

source

ArgumentException

Property path is empty. - propertyPath or Property '{propertyName}' not found on type '{currentValue.GetType().Name}'.

InvalidOperationException

Property '{propertyName}' returned null, cannot access further properties.

GetPropertyValue(object, string[], int?)

Gets the property value.

public static object GetPropertyValue(object source, string[] properties, int? dataIndex = null)

Parameters

source object

The source.

properties string[]

The properties.

dataIndex int?

Returns

object

Exceptions

ArgumentNullException

source

ArgumentException

Property path is null. - properties or Property '{propertyName}' not found on type '{currentValue.GetType().Name}'.

InvalidOperationException

Property '{propertyName}' returned null, cannot access further properties.