SiteMapNodeCollection.ReadOnly メソッド
アセンブリ: System.Web (system.web.dll 内)

Public Shared Function ReadOnly ( _ collection As SiteMapNodeCollection _ ) As SiteMapNodeCollection
Dim collection As SiteMapNodeCollection Dim returnValue As SiteMapNodeCollection returnValue = SiteMapNodeCollection.ReadOnly(collection)
public static SiteMapNodeCollection ReadOnly ( SiteMapNodeCollection collection )
public: static SiteMapNodeCollection^ ReadOnly ( SiteMapNodeCollection^ collection )
public static SiteMapNodeCollection ReadOnly ( SiteMapNodeCollection collection )
public static function ReadOnly ( collection : SiteMapNodeCollection ) : SiteMapNodeCollection
- collection
読み取り専用 SiteMapNodeCollection に追加する SiteMapNode オブジェクトを格納している SiteMapNodeCollection。
元の SiteMapNodeCollection と同じ SiteMapNode 要素および構造を持つ読み取り専用 SiteMapNodeCollection。

例外の種類 | 条件 |
---|---|
ArgumentNullException | collection が null 参照 (Visual Basic では Nothing) です。 |

IsReadOnly プロパティをチェックすることにより、SiteMapNodeCollection コレクションが読み取り専用であるかどうかをテストできます。IsFixedSize プロパティは、SiteMapNodeCollection が読み取り専用の場合にも true を返します。
実装時の注意 読み取り専用 SiteMapNodeCollection コレクションは、読み取り操作および検索操作をサポートしますが、Add、AddRange、Clear、Insert、Remove、RemoveAt の各メソッド、および既定のインデクサ プロパティ Item の設定側をサポートしません。
IsReadOnly プロパティを使用して SiteMapNodeCollection コレクションが読み取り専用か変更可能かをテストする方法を次のコード例に示します。siteNodes が変更可能の場合、それに対して MoveNode が呼び出されます。それ以外の場合、siteNodes をベースとして SiteMapNodeCollection が作成されます。
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSiteMapNodeCollection.ReadOnly メソッドを検索する場合は、下記のリンクをクリックしてください。

- SiteMapNodeCollection.ReadOnly メソッドのページへのリンク