HierarchyId
HierarchyId
class provides tools for operating with identificators of objects combined into hierarchical structure. The idea of hierarchical id becomes helpful when working of objects combined into hierarchical structures. It could be organization departments for example.
Instance of HierarchyId
represents hierarchical identificator for node and contain ids of all ancestors for current node. For example it could be: "/10/38/94/", which means that current node has id=94
, its parent id is 38
and grandparent id is 10
.
Methods of this class allows getting ancestor of needed level, check if current node is descendant of some other node, move nodes in hierarchy etc.
All methods are described below:
Methods
Method name | Return type | Description |
---|---|---|
Constructor |
| Initializes a new instance of the |
GetNode |
| Gets last node in current branch of hierarchy |
IsDescendantOf |
| Determines whether current node is descendant of specified node. |
GetAncestor |
| Gets ancestor of current node n-levels higher than itself. |
GetDescendant |
| Gets hierarchical id for direct descendant of current node with regular id specified. |
GetLevel | int | Gets level in hierarchy for current node. |
Move | - | Moves current node from its current ancestor to new one. |
ToString |
| Creates string representation of current HierarchyId. |
Parse |
| Creates |
Basic usage
Last updated