SiteMapNodeCollection.AddRange Método

Definição

Adiciona um conjunto de objetos SiteMapNode à coleção.Adds a set of SiteMapNode objects to the collection.

Sobrecargas

AddRange(SiteMapNode[])

Adiciona uma matriz de tipo SiteMapNode à coleção.Adds an array of type SiteMapNode to the collection.

AddRange(SiteMapNodeCollection)

Adiciona os nós no SiteMapNodeCollection especificado à coleção atual.Adds the nodes in the specified SiteMapNodeCollection to the current collection.

AddRange(SiteMapNode[])

Adiciona uma matriz de tipo SiteMapNode à coleção.Adds an array of type SiteMapNode to the collection.

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[]

Uma matriz de tipo SiteMapNode a ser adicionada ao SiteMapNodeCollection atual.An array of type SiteMapNode to add to the current SiteMapNodeCollection.

Exceções

value é null.value is null.

O SiteMapNodeCollection é somente leitura.The SiteMapNodeCollection is read-only.

Comentários

A matriz que é passada para o AddRange método pode conter null valores; no entanto, isso leva a exceções inesperadas quando a SiteMapNodeCollection coleção é manipulada.The array that is passed to the AddRange method can contain null values; however, this leads to unexpected exceptions when the SiteMapNodeCollection collection is manipulated.

Você não pode adicionar um SiteMapNode objeto a um tamanho somente leitura ou fixo SiteMapNodeCollection .You cannot add a SiteMapNode object to a read-only or fixed-size SiteMapNodeCollection. Você pode testar se um SiteMapNodeCollection é somente leitura verificando a IsReadOnly propriedade.You can test whether a SiteMapNodeCollection is read-only by checking the IsReadOnly property.

Confira também

Aplica-se a

AddRange(SiteMapNodeCollection)

Adiciona os nós no SiteMapNodeCollection especificado à coleção atual.Adds the nodes in the specified SiteMapNodeCollection to the current collection.

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

Um SiteMapNodeCollection que contém os objetos SiteMapNode a serem adicionados ao SiteMapNodeCollection atual.A SiteMapNodeCollection that contains the SiteMapNode objects to add to the current SiteMapNodeCollection.

Exceções

value é null.value is null.

O SiteMapNodeCollection é somente leitura.The SiteMapNodeCollection is read-only.

Exemplos

O exemplo de código a seguir demonstra como criar uma coleção modificável SiteMapNodeCollection e, em seguida, adicionar SiteMapNode objetos a ela usando o AddRange método.The following code example demonstrates how to create a modifiable SiteMapNodeCollection collection, and then add SiteMapNode objects to it using the AddRange method.


// 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

Comentários

A SiteMapNodeCollection coleção que é passada para o AddRange método pode conter null SiteMapNode objetos; no entanto, isso leva a exceções inesperadas quando o SiteMapNodeCollection é manipulado.The SiteMapNodeCollection collection that is passed to the AddRange method can contain nullSiteMapNode objects; however, this leads to unexpected exceptions when the SiteMapNodeCollection is manipulated.

Você não pode adicionar um SiteMapNode objeto a um tamanho somente leitura ou fixo SiteMapNodeCollection .You cannot add a SiteMapNode object to a read-only or fixed-size SiteMapNodeCollection. Você pode testar se um SiteMapNodeCollection é somente leitura verificando a IsReadOnly propriedade.You can test whether a SiteMapNodeCollection is read-only by checking the IsReadOnly property.

Confira também

Aplica-se a