This documentation is archived and is not being maintained.

SiteMapNodeCollection::ReadOnly Method

Returns a read-only collection that contains the nodes in the specified SiteMapNodeCollection collection.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public:
static SiteMapNodeCollection^ ReadOnly(
	SiteMapNodeCollection^ collection
)

Parameters

collection
Type: System.Web::SiteMapNodeCollection

The SiteMapNodeCollection that contains the SiteMapNode objects to add to the read-only SiteMapNodeCollection.

Return Value

Type: System.Web::SiteMapNodeCollection
A read-only SiteMapNodeCollection with the same SiteMapNode elements and structure as the original SiteMapNodeCollection.

ExceptionCondition
ArgumentNullException

collection is nullptr.

You can test whether a SiteMapNodeCollection collection is read-only by checking the IsReadOnly property. The IsFixedSize property also returns true when a SiteMapNodeCollection is read-only.

Notes to Implementers:

A read-only SiteMapNodeCollection collection supports read and search operations, but does not support the Add, AddRange, Clear, Insert, Remove, and RemoveAt methods, nor the setter on the default indexer property, Item.

The following code example demonstrates how to use the IsReadOnly property to test whether a SiteMapNodeCollection collection is read-only or modifiable. If siteNodes is modifiable, MoveNode is called on it; otherwise, a clone SiteMapNodeCollection is created, using siteNodes as a base.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: