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


SiteMapNodeCollection コンストラクタを使用して、空の SiteMapNodeCollection コレクションを作成します。Add、AddRange、または Insert の各メソッドを使用して、要素を SiteMapNodeCollection に追加できます。

SiteMapNodeCollection コンストラクタを使用して新しい SiteMapNodeCollection コレクションを作成し、Add メソッドを使用して要素を SiteMapNodeCollection に追加する方法を次のコード例に示します。
' The LoadSiteMapData() Function loads site navigation ' data from persistent storage into a DataTable. Dim siteMapData As DataTable siteMapData = LoadSiteMapData() ' Create a SiteMapNodeCollection. Dim nodes As New SiteMapNodeCollection() ' Create a SiteMapNode and add it to the collection. Dim tempNode As SiteMapNode Dim row As DataRow Dim index As Integer index = 0 While (index < siteMapData.Rows.Count) row = siteMapData.Rows(index) ' Create a node based on the data in the DataRow. tempNode = New SiteMapNode(SiteMap.Provider, row("Key").ToString(), row("Url").ToString()) ' Add the node to the collection. nodes.Add(tempNode) index = index + 1 End While
// The LoadSiteMapData() method loads site navigation // data from persistent storage into a DataTable. DataTable siteMap = LoadSiteMapData(); // Create a SiteMapNodeCollection. SiteMapNodeCollection nodes = new SiteMapNodeCollection(); // Create a SiteMapNode and add it to the collection. SiteMapNode tempNode; DataRow row; int index = 0; while (index < siteMap.Rows.Count) { row = siteMap.Rows[index]; // Create a node based on the data in the DataRow. tempNode = new SiteMapNode(SiteMap.Provider, row["Key"].ToString(), row["Url"].ToString()); // Add the node to the collection. nodes.Add(tempNode); ++index; }

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 コンストラクタ (SiteMapNode)
アセンブリ: System.Web (system.web.dll 内)



SiteMapNodeCollection コンストラクタを使用して、単一の初期 SiteMapNode オブジェクトを持つ SiteMapNodeCollection コレクションを作成します。Add、AddRange、または Insert の各メソッドを使用して、要素を SiteMapNodeCollection に追加できます。

単一の初期 SiteMapNode オブジェクトを持つ SiteMapNodeCollection コレクションを作成し、AddRange メソッドを使用して、それに SiteMapNode オブジェクトの SiteMapNodeCollection を追加する方法を次のコード例に示します。個々の SiteMapNode オブジェクトが読み取り専用でも、SiteMapNodeCollection を変更できます。
' 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>"); }

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 コンストラクタ (SiteMapNodeCollection)
アセンブリ: System.Web (system.web.dll 内)



SiteMapNodeCollection コンストラクタを使用することは、SiteMapNodeCollection コンストラクタを呼び出し、AddRange メソッドを使用して要素を SiteMapNodeCollection コレクションに追加することと等価です。

SiteMapNodeCollection コレクションを、SiteMapNode オブジェクトの別の SiteMapNodeCollection をベースとして使用して作成する方法を次のコード例に示します。SiteMapNode.GetAllNodes メソッドは 読み取り専用の SiteMapNodeCollection を返します。これは、IsReadOnly プロパティが true を返す場合に検出されます。新しい SiteMapNodeCollection が読み取り専用の SiteMapNodeCollection を使用して作成され、Add メソッドおよび Remove メソッドは正常に呼び出されます。
Dim siteNodes As SiteMapNodeCollection siteNodes = SiteMap.RootNode.GetAllNodes() If siteNodes.IsReadOnly Or siteNodes.IsFixedSize Then Response.Write("Collection is read-only or has fixed size.<BR>") ' Create a new, modifiable collection from the existing one. Dim modifiableCollection As SiteMapNodeCollection modifiableCollection = New SiteMapNodeCollection(siteNodes) ' The MoveNode example method moves a node from position one to ' the last position in the collection. MoveNode(modifiableCollection) Else MoveNode(siteNodes) End If
SiteMapNodeCollection siteNodes = SiteMap.RootNode.GetAllNodes(); if ( siteNodes.IsReadOnly || siteNodes.IsFixedSize ) { Response.Write("Collection is read-only or has fixed size.<BR>"); // Create a new, modifiable collection from the existing one. SiteMapNodeCollection modifiableCollection = new SiteMapNodeCollection(siteNodes); // The MoveNode example method moves a node from position one to // the last position in the collection. MoveNode(modifiableCollection); } else { MoveNode(siteNodes); }

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 コンストラクタ (Int32)
アセンブリ: System.Web (system.web.dll 内)



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 コンストラクタ

名前 | 説明 |
---|---|
SiteMapNodeCollection () | SiteMapNodeCollection クラスの新しいインスタンスを初期化します。これが既定のインスタンスです。 |
SiteMapNodeCollection (Int32) | 指定した初期量を使用して、SiteMapNodeCollection クラスの新しいインスタンスを初期化します。 |
SiteMapNodeCollection (SiteMapNode) | SiteMapNodeCollection クラスの新しいインスタンスを初期化して、SiteMapNode オブジェクトをコレクションの InnerList プロパティに追加します。 |
SiteMapNodeCollection (SiteMapNode[]) | SiteMapNodeCollection クラスの新しいインスタンスを初期化して、SiteMapNode 型の配列をコレクションの InnerList プロパティに追加します。 |
SiteMapNodeCollection (SiteMapNodeCollection) | SiteMapNodeCollection クラスの新しいインスタンスを初期化して、指定した SiteMapNodeCollection コレクションのリスト項目をすべてコレクションの InnerList プロパティに追加します。 |

SiteMapNodeCollection コンストラクタ (SiteMapNode[])
アセンブリ: System.Web (system.web.dll 内)



SiteMapNodeCollection コンストラクタを使用することは、SiteMapNodeCollection コンストラクタを呼び出し、AddRange メソッドを使用して要素を 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 コンストラクタ ()のページへのリンク