SiteMapNodeCollection.ReadOnly メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SiteMapNodeCollection.ReadOnly メソッドの意味・解説 

SiteMapNodeCollection.ReadOnly メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

指定した SiteMapNodeCollection コレクションのノードが格納されている読み取り専用コレクションを返します。

名前空間: System.Web
アセンブリ: 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);
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SiteMapNodeCollection クラス
SiteMapNodeCollection メンバ
System.Web 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

SiteMapNodeCollection.ReadOnly メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SiteMapNodeCollection.ReadOnly メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS