IHierarchyData.GetParent Method
Assembly: System.Web (in system.web.dll)
The IHierarchyData interface does not define a HasParent convenience property, so callers must check the return value of the GetParent method for a null reference (Nothing in Visual Basic) to determine whether the current IHierarchyData node is the root node of the hierarchical data structure to which the node belongs.
The following code example demonstrates how to implement the GetParent method in a class that implements the IHierarchyData interface. The FileSystemHierarchyData class wraps a FileSystemInfo object, and the GetParent method implementation checks the type of the FileSystemInfo object, and returns the appropriate parent object based on the type. This code example is part of a larger example provided for the IHierarchyData interface and the HierarchicalDataSourceControl class.