SiteMapNodeCollection.AddRange Méthode

Définition

Ajoute un ensemble d'objets SiteMapNode à la collection.

Surcharges

AddRange(SiteMapNode[])

Ajoute un tableau de type SiteMapNode à la collection.

AddRange(SiteMapNodeCollection)

Ajoute les nœuds dans le spécifié SiteMapNodeCollection à la collection actuelle.

AddRange(SiteMapNode[])

Ajoute un tableau de type SiteMapNode à la 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())

Paramètres

value
SiteMapNode[]

Tableau de type SiteMapNode à ajouter au SiteMapNodeCollection actuel.

Exceptions

value a la valeur null.

Remarques

Le tableau passé à la AddRange méthode peut contenir des null valeurs ; toutefois, cela entraîne des exceptions inattendues lorsque la SiteMapNodeCollection collection est manipulée.

Vous ne pouvez pas ajouter un SiteMapNode objet à un objet en lecture seule ou de taille SiteMapNodeCollectionfixe . Vous pouvez tester si un SiteMapNodeCollection est en lecture seule en vérifiant la IsReadOnly propriété .

Voir aussi

S’applique à

AddRange(SiteMapNodeCollection)

Ajoute les nœuds dans le spécifié SiteMapNodeCollection à la collection actuelle.

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)

Paramètres

value
SiteMapNodeCollection

SiteMapNodeCollection qui contient les objets SiteMapNode à ajouter au SiteMapNodeCollection actuel.

Exceptions

value a la valeur null.

Exemples

L’exemple de code suivant montre comment créer une collection modifiable SiteMapNodeCollection , puis y ajouter SiteMapNode des objets à l’aide de la AddRange méthode .


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

Remarques

La SiteMapNodeCollection collection passée à la AddRange méthode peut contenir des nullSiteMapNode objets . Toutefois, cela entraîne des exceptions inattendues lorsque est SiteMapNodeCollection manipulé.

Vous ne pouvez pas ajouter un SiteMapNode objet à un objet en lecture seule ou de taille SiteMapNodeCollectionfixe . Vous pouvez tester si un SiteMapNodeCollection est en lecture seule en vérifiant la IsReadOnly propriété .

Voir aussi

S’applique à