SiteMapNodeCollection クラス
アセンブリ: System.Web (system.web.dll 内)

Public Class SiteMapNodeCollection Implements IHierarchicalEnumerable, IList, ICollection, IEnumerable

SiteMapNodeCollection クラスは、SiteMapNode オブジェクトの厳密に型指定されたコレクションを提供します。また、SiteMapNode オブジェクトをインデックス番号が 0 から始まる配列に内部的に格納します。
SiteMapNodeCollection コレクションは、最初に作成するときに変更できます。その後、次のメソッドを使用して SiteMapNode オブジェクトの追加、コピー、および削除ができます。
読み取り専用の SiteMapNodeCollection を作成できます。これに対する SiteMapNode オブジェクトの追加、コピー、または削除はできません。作成には、静的な ReadOnly メソッドを使用します。メソッド SiteMapNode.GetAllNodes および GetChildren によって返される SiteMapNodeCollection コレクションは、読み取り専用です。プロバイダから返された SiteMapNode オブジェクト上で ChildNodes プロパティがアクセスされたときに返される SiteMapNodeCollection も同様です。既定のインデクサ プロパティを設定するか、次のメソッドのどれかを使用して、読み取り専用の SiteMapNodeCollection を変更しようとすると、NotSupportedException 例外がスローされます。
上記にリストされているメソッドのどれかを呼び出す前に、IsReadOnly プロパティを使用してコレクションを確認してください。

SiteMapNodeCollection コレクションを作成し、AddRange メソッドを使用して、それに SiteMapNode オブジェクトを追加する方法を次のコード例に示します。SiteMapNodeCollection は、現在のサイト マップのサブセットで、上位 2 階層レベルのみ表示します。
' 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
// 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>"); }


System.Web.SiteMapNodeCollection


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SiteMapNodeCollection クラスのページへのリンク