Table of Contents

HasCircularReference Method

Definition

Namespace
Cuemon
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/Extensions/TypeDecoratorExtensions.cs

HasCircularReference(IDecorator<Type>, object, int, Func<object, PropertyInfo, object>)

Determines whether the specified source (which type must be the same as the underlying Type of the decorator) has a circular reference.

public static bool HasCircularReference(this IDecorator<Type> decorator, object source, int maxDepth = 2, Func<object, PropertyInfo, object> valueResolver = null)

Parameters

decorator IDecorator<Type>

The IDecorator<T> to extend.

source object

The source to check for circular reference.

maxDepth int

The maximum depth to traverse of source.

valueResolver Func<object, PropertyInfo, object>

The function delegate that is invoked when a property can be read and is of same type as the underlying Type of the decorator.

Returns

bool

true if the specified source has a circular reference; otherwise, false.

Exceptions

ArgumentNullException

decorator cannot be null.

InvalidOperationException

source has a different type than the underlying type of decorator.