Interface IHierarchy<T>
- Namespace
- Cuemon.Extensions.Runtime
- Assembly
- Cuemon.Extensions.Core.dll
Provides a generic way to expose a node of a hierarchical structure, including the node object of type T
.
public interface IHierarchy<T> : IWrapper<T>, IData
Type Parameters
T
The type of the node represented in the hierarchical structure.
- Inherited Members
- Extension Methods
Properties
Depth
Gets the current depth of the node in the hierarchical structure.
int Depth { get; }
Property Value
- Int32
The current depth of the node in the hierarchical structure.
HasChildren
Indicates whether the current node has any child nodes.
bool HasChildren { get; }
Property Value
- Boolean
true
if the current node has any child nodes; otherwise,false
.
HasParent
Indicates whether the current node has a parent node.
bool HasParent { get; }
Property Value
- Boolean
true
if the current node has a parent node; otherwise,false
.
Index
Gets the zero-based index of the current node that this hierarchical structure represents.
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.
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.
IHierarchy<T> Add(T instance)
Parameters
instance
TThe 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.
IHierarchy<T> Add(T instance, MemberInfo member)
Parameters
instance
TThe instance to a node in the hierarchical structure represents.
member
MemberInfoThe member from where
instance
was referenced.
Returns
- IHierarchy<T>
A reference to the newly added hierarchical node.
GetChildren()
Gets an IEnumerable<T> sequence that represents all the child nodes of the current hierarchical node.
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.
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.
string GetPath()
Returns
GetPath(Func<IHierarchy<T>, String>)
Gets the hierarchical path of the node in the hierarchical structure.
string GetPath(Func<IHierarchy<T>, string> pathResolver)
Parameters
pathResolver
Func<IHierarchy<T>, String>The function delegate that resolves the hierarchical path of the node in the hierarchical structure.
Returns
Replace(T)
Allows for the instance on the current node to be replaced with a new instance
.
void Replace(T instance)
Parameters
instance
TThe new instance to replace the original with.