SiteMapNodeCollection Class
TOC
Collapse the table of content
Expand the table of content

SiteMapNodeCollection Class

 

Provides a strongly typed collection for SiteMapNode objects and implements the IHierarchicalEnumerable interface to support navigating through the collection.

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

System.Object
  System.Web.SiteMapNodeCollection

public class SiteMapNodeCollection : IHierarchicalEnumerable, 
	IEnumerable, IList, ICollection

NameDescription
System_CAPS_pubmethodSiteMapNodeCollection()

Initializes a new instance of the SiteMapNodeCollection class, which is the default instance.

System_CAPS_pubmethodSiteMapNodeCollection(Int32)

Initializes a new instance of the SiteMapNodeCollection class with the specified initial capacity.

System_CAPS_pubmethodSiteMapNodeCollection(SiteMapNode)

Initializes a new instance of the SiteMapNodeCollection class and adds the SiteMapNode object to the InnerList property for the collection.

System_CAPS_pubmethodSiteMapNodeCollection(SiteMapNode[])

Initializes a new instance of the SiteMapNodeCollection class and adds the array of type SiteMapNode to the InnerList property for the collection.

System_CAPS_pubmethodSiteMapNodeCollection(SiteMapNodeCollection)

Initializes a new instance of the SiteMapNodeCollection class and adds all the list items of the specified SiteMapNodeCollection collection to the InnerList property for the collection.

NameDescription
System_CAPS_pubpropertyCount

Gets the number of elements contained in the collection.

System_CAPS_pubpropertyIsFixedSize

Gets a Boolean value indicating whether nodes can be added to or subtracted from the collection.

System_CAPS_pubpropertyIsReadOnly

Gets a Boolean value indicating whether the collection is read-only.

System_CAPS_pubpropertyIsSynchronized

Gets a Boolean value indicating whether access to the collection is synchronized (thread safe).

System_CAPS_pubpropertyItem[Int32]

Gets or sets the SiteMapNode object at the specified index in the collection.

System_CAPS_pubpropertySyncRoot

Gets an object that can be used to synchronize access to the collection.

NameDescription
System_CAPS_pubmethodAdd(SiteMapNode)

Adds a single SiteMapNode object to the collection.

System_CAPS_pubmethodAddRange(SiteMapNode[])

Adds an array of type SiteMapNode to the collection.

System_CAPS_pubmethodAddRange(SiteMapNodeCollection)

Adds the nodes in the specified SiteMapNodeCollection to the current collection.

System_CAPS_pubmethodClear()

Removes all items from the collection.

System_CAPS_pubmethodContains(SiteMapNode)

Determines whether the collection contains a specific SiteMapNode object.

System_CAPS_pubmethodCopyTo(SiteMapNode[], Int32)

Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetDataSourceView(SiteMapDataSource, String)

Retrieves the SiteMapDataSourceView object that is associated with the nodes in the current collection.

System_CAPS_pubmethodGetEnumerator()

Retrieves a reference to an enumerator object, which is used to iterate over the collection.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetHierarchicalDataSourceView()

Retrieves the SiteMapHierarchicalDataSourceView object that is associated with the nodes in the current collection.

System_CAPS_pubmethodGetHierarchyData(Object)

Returns a hierarchical data item for the specified enumerated item.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodIndexOf(SiteMapNode)

Searches for the specified SiteMapNode object, and then returns the zero-based index of the first occurrence within the entire collection.

System_CAPS_pubmethodInsert(Int32, SiteMapNode)

Inserts the specified SiteMapNode object into the collection at the specified index.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnValidate(Object)

Performs additional custom processes when validating a value.

System_CAPS_pubmethodSystem_CAPS_staticReadOnly(SiteMapNodeCollection)

Returns a read-only collection that contains the nodes in the specified SiteMapNodeCollection collection.

System_CAPS_pubmethodRemove(SiteMapNode)

Removes the specified SiteMapNode object from the collection.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the SiteMapNode object at the specified index of the collection.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodICollection.CopyTo(Array, Int32)

This API supports the product infrastructure and is not intended to be used directly from your code. Copies the elements of the ICollection interface to an array, starting at a particular array index. This class cannot be inherited.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

This API supports the product infrastructure and is not intended to be used directly from your code. Returns an enumerator that iterates through a collection. For a description of this member, see IEnumerable.GetEnumerator.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Add(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Adds an item to the collection in the IList interface. For a description of this member, see IList.Add.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Clear()

This API supports the product infrastructure and is not intended to be used directly from your code. Removes all items from the collection in the IList interface. For a description of this member, see IList.Clear.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Contains(Object)

Determines whether the collection in the IList interface contains the specified Boolean value.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.IndexOf(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Determines the index of the specific item in the collection that is returned by the IList interface. For a description of this member, see IList.IndexOf.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Insert(Int32, Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Inserts an item into the collection in the IList interface at the specified index. For a description of this member, see IList.Insert.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Remove(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Removes the first occurrence of a specified object from the collection in the IList interface. For a description of this member, see IList.Remove.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.RemoveAt(Int32)

This API supports the product infrastructure and is not intended to be used directly from your code. Removes the IList item at the specified index. For a description of this member, see IList.RemoveAt.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIHierarchicalEnumerable.GetHierarchyData(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Returns a hierarchical data item for the specified enumerated item. For a description of this member, see IHierarchicalEnumerable.GetHierarchyData.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.Count

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the number of elements that are contained in the ICollection interface. This class cannot be inherited.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.IsSynchronized

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a Boolean value indicating whether access to the ICollection interface is synchronized (thread safe). This class cannot be inherited.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.SyncRoot

This API supports the product infrastructure and is not intended to be used directly from your code. Gets an object that can be used to synchronize access to the ICollection interface. This class cannot be inherited.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.IsFixedSize

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a Boolean value indicating whether the collection has a fixed size. For a description of this member, see IList.IsFixedSize.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.IsReadOnly

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a Boolean value indicating whether the collection is read-only. For a description of this member, see IList.IsReadOnly.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.Item[Int32]

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the IList element at the specified index.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

The SiteMapNodeCollection class provides a strongly typed collection for SiteMapNode objects. It stores SiteMapNode objects internally in a zero-based array.

You can modify a SiteMapNodeCollection collection when it is first created, and then use the following methods to add, copy, and remove SiteMapNode objects:

You can create a read-only SiteMapNodeCollection, which does not permit adding, copying, nor removing SiteMapNode objects, by using the static ReadOnly method. The SiteMapNodeCollection collections that are returned by the SiteMapNode.GetAllNodes and GetChildren methods are read-only, as is the SiteMapNodeCollection that is returned when the ChildNodes property is accessed on a SiteMapNode object that is returned from a provider. A NotSupportedException exception is thrown, if you attempt to modify a read-only SiteMapNodeCollection by setting the default indexer property or by using any of the following methods:

Use the IsReadOnly property to check the collection before calling any of the methods in the preceding list.

The following code example demonstrates how to create a SiteMapNodeCollection collection, and then add SiteMapNode objects to it using the AddRange method. The SiteMapNodeCollection is a subset of the current site map, showing only the first two hierarchical levels.


// Create a SiteMapNodeCollection with all the nodes
// from the first two hierarchical levels of the current
// site map.
SiteMapNodeCollection baseCollection =
    new SiteMapNodeCollection(SiteMap.RootNode);

SiteMapNodeCollection childCollection =
    SiteMap.RootNode.ChildNodes;

baseCollection.AddRange(childCollection);

Response.Write( "<BR>Derived SiteMapNodeCollection.<BR><HR><BR>");
foreach (SiteMapNode node in baseCollection) {
    Response.Write( node.Title + "<BR>");
}

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft