IHierarchicalEnumerable Interface

Represents a hierarchical collection that can be enumerated with an IEnumerator interface. Collections that implement the IHierarchicalEnumerable interface are used by ASP.NET site navigation and data source controls.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public interface IHierarchicalEnumerable : IEnumerable

The IHierarchicalEnumerable type exposes the following members.

  NameDescription
Public methodGetEnumeratorReturns an enumerator that iterates through a collection. (Inherited from IEnumerable.)
Public methodGetHierarchyDataReturns a hierarchical data item for the specified enumerated item.
Top

  NameDescription
Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top

The IHierarchicalEnumerable interface extends the IEnumerable interface and exposes GetHierarchyData, which is a method used to retrieve an IHierarchyData object from an enumerated item, in addition to the GetEnumerator method.

Typically, clients that use IHierarchicalEnumerable collections retrieve an IEnumerator object by calling the GetEnumerator method, then iterate through the enumeration and call the GetHierarchyData on each enumerated item to retrieve an IHierarchyData object.

The following code example demonstrates how to implement the IHierarchicalEnumerable interface with a class that extends ArrayList and provides a collection of IHierarchyData objects that wrap FileSystemInfo objects. The IHierarchicalEnumerable collection is used by classes that derive from HierarchicalDataSourceView to return a collection of hierarchical nodes when the Select method is called. This code example is part of a larger example provided for the HierarchicalDataSourceControl class.

    // A collection of FileSystemHierarchyData objects 
    public class FileSystemHierarchicalEnumerable :
        ArrayList, IHierarchicalEnumerable
    {
        public FileSystemHierarchicalEnumerable()
            : base()
        {
        }

        public IHierarchyData GetHierarchyData(object enumeratedItem)
        {
            return enumeratedItem as IHierarchyData;
        }
    }

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft