HasCircularReference Method
Definition
- Namespace
- Cuemon
- Assemblies
- Cuemon.Core.dll
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
decoratorIDecorator<Type>The IDecorator<T> to extend.
sourceobjectThe source to check for circular reference.
maxDepthintThe maximum depth to traverse of
source.valueResolverFunc<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
trueif the specifiedsourcehas a circular reference; otherwise,false.
Exceptions
- ArgumentNullException
decoratorcannot be null.- InvalidOperationException
sourcehas a different type than the underlying type ofdecorator.