SiteMapNodeCollection.AddRange Método

Definición

Agrega un conjunto de objetos SiteMapNode a la colección.

Sobrecargas

AddRange(SiteMapNode[])

Agrega una matriz de tipo SiteMapNode a la colección.

AddRange(SiteMapNodeCollection)

Agrega los nodos del especificado SiteMapNodeCollection a la colección actual.

AddRange(SiteMapNode[])

Agrega una matriz de tipo SiteMapNode a la colección.

public:
 virtual void AddRange(cli::array <System::Web::SiteMapNode ^> ^ value);
public virtual void AddRange (System.Web.SiteMapNode[] value);
abstract member AddRange : System.Web.SiteMapNode[] -> unit
override this.AddRange : System.Web.SiteMapNode[] -> unit
Public Overridable Sub AddRange (value As SiteMapNode())

Parámetros

value
SiteMapNode[]

Matriz de tipo SiteMapNode que se va a agregar a la colección SiteMapNodeCollection actual.

Excepciones

value es null.

Comentarios

La matriz que se pasa al AddRange método puede contener null valores; sin embargo, esto provoca excepciones inesperadas cuando se manipula la SiteMapNodeCollection colección.

No se puede agregar un SiteMapNode objeto a un tamaño fijo o de solo lectura SiteMapNodeCollection. Puede probar si es de SiteMapNodeCollection solo lectura comprobando la IsReadOnly propiedad .

Consulte también

Se aplica a

AddRange(SiteMapNodeCollection)

Agrega los nodos del especificado SiteMapNodeCollection a la colección actual.

public:
 virtual void AddRange(System::Web::SiteMapNodeCollection ^ value);
public virtual void AddRange (System.Web.SiteMapNodeCollection value);
abstract member AddRange : System.Web.SiteMapNodeCollection -> unit
override this.AddRange : System.Web.SiteMapNodeCollection -> unit
Public Overridable Sub AddRange (value As SiteMapNodeCollection)

Parámetros

value
SiteMapNodeCollection

SiteMapNodeCollection que contiene los objetos SiteMapNode que se van a agregar a la SiteMapNodeCollection actual.

Excepciones

value es null.

Ejemplos

En el ejemplo de código siguiente se muestra cómo crear una colección modificable SiteMapNodeCollection y, a continuación, agregarle SiteMapNode objetos mediante el AddRange método .


// 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>");
}

' Create a SiteMapNodeCollection with all the nodes
' from the first two hierarchical levels of the current
' site map.
Dim baseCollection As SiteMapNodeCollection
baseCollection = New SiteMapNodeCollection(SiteMap.RootNode)

Dim childCollection As SiteMapNodeCollection = SiteMap.RootNode.ChildNodes

baseCollection.AddRange(childCollection)

Response.Write( "<BR>Derived SiteMapNodeCollection.<BR><HR><BR>")

For Each node In baseCollection
    Response.Write( node.Title + "<BR>")
Next

Comentarios

La SiteMapNodeCollection colección que se pasa al AddRange método puede contener nullSiteMapNode objetos; sin embargo, esto conduce a excepciones inesperadas cuando se manipula .SiteMapNodeCollection

No se puede agregar un SiteMapNode objeto a un tamaño fijo o de solo lectura SiteMapNodeCollection. Puede probar si es de SiteMapNodeCollection solo lectura comprobando la IsReadOnly propiedad .

Consulte también

Se aplica a