Table of Contents

Class Hierarchy<T>

Namespace
Cuemon.Extensions.Runtime
Assembly
Cuemon.Extensions.Core.dll

Represents a way to expose a node of a hierarchical structure, including the node object of type T.

public sealed class Hierarchy<T> : Wrapper<T>, IHierarchy<T>, IWrapper<T>, IData

Type Parameters

T

The type of the object represented in the hierarchical structure.

Inheritance
Hierarchy<T>
Implements
Inherited Members
Extension Methods

Constructors

Hierarchy()

Initializes a new instance of the Hierarchy<T> class.

public Hierarchy()

Properties

Depth

Gets the current depth of the node in the hierarchical structure.

public int Depth { get; }

Property Value

Int32

The current depth of the in the hierarchical structure.

HasChildren

Gets a value indicating whether this instance has any children.

public bool HasChildren { get; }

Property Value

Boolean

true if this instance has any children; otherwise, false.

HasParent

Gets a value indicating whether this instance has a parent.

public bool HasParent { get; }

Property Value

Boolean

true if this instance has a parent; otherwise, false.

Index

Gets the zero-based index of the current node that this hierarchical structure represents.

public int Index { get; }

Property Value

Int32

The zero-based index of the current node that this hierarchical structure represents.

Item[Int32]

Gets the node at the specified index.

public IHierarchy<T> this[int index] { get; }

Parameters

index Int32

Property Value

IHierarchy<T>

The node at the specified index.

Methods

Add(T)

Adds the specified instance to a node in the hierarchical structure representation.

public IHierarchy<T> Add(T instance)

Parameters

instance T

The instance to a node in the hierarchical structure represents.

Returns

IHierarchy<T>

A reference to the newly added hierarchical node.

Add(T, MemberInfo)

Adds the specified instance to a node in the hierarchical structure representation.

public IHierarchy<T> Add(T instance, MemberInfo member)

Parameters

instance T

The instance to a node in the hierarchical structure represents.

member MemberInfo

The member from where instance was referenced.

Returns

IHierarchy<T>

A reference to the newly added hierarchical node.

Add(T, Type)

Adds the specified instance to a node in the hierarchical structure representation.

public IHierarchy<T> Add(T instance, Type instanceType)

Parameters

instance T

The instance to a node in the hierarchical structure represents.

instanceType Type

The type of instance.

Returns

IHierarchy<T>

A reference to the newly added hierarchical node.

Exceptions

ArgumentNullException

instanceType is null.

Add(T, Type, MemberInfo)

Adds the specified instance to a node in the hierarchical structure representation.

public IHierarchy<T> Add(T instance, Type instanceType, MemberInfo member)

Parameters

instance T

The instance to a node in the hierarchical structure represents.

instanceType Type

The type of instance.

member MemberInfo

The member from where instance was referenced.

Returns

IHierarchy<T>

A reference to the newly added hierarchical node.

Exceptions

ArgumentNullException

instanceType is null.

GetChildren()

Gets an IEnumerable<T> sequence that represents all the child nodes of the current hierarchical node.

public IEnumerable<IHierarchy<T>> GetChildren()

Returns

IEnumerable<IHierarchy<T>>

An IEnumerable<T> sequence that represents all the child nodes of the current hierarchical node.

GetParent()

Gets the parent node of the current node in the hierarchical structure.

public IHierarchy<T> GetParent()

Returns

IHierarchy<T>

The parent node of the current node in the hierarchical structure.

GetPath()

Gets the hierarchical path of the node in the hierarchical structure.

public string GetPath()

Returns

String

A String that identifies the hierarchical path relative to the current node.

GetPath(Func<IHierarchy<T>, String>)

Gets the hierarchical path of the node in the hierarchical structure.

public string GetPath(Func<IHierarchy<T>, string> pathResolver)

Parameters

pathResolver Func<IHierarchy<T>, String>

The function delegate path resolver.

Returns

String

A String that identifies the hierarchical path relative to the current node.

Replace(T)

Allows for the instance on the current node to be replaced with a new instance.

public void Replace(T instance)

Parameters

instance T

The new instance to replace the original with.

Replace(T, Type)

Allows for the instance on the current node to be replaced with a new instance.

public void Replace(T instance, Type instanceType)

Parameters

instance T

The new instance to replace the original with.

instanceType Type

The type of the new instance.