Edit

Share via


SiteMapProviderCollection.Item[String] Property

Definition

Gets a SiteMapProvider object with a specific name from the provider collection.

C#
public System.Web.SiteMapProvider this[string name] { get; }

Parameters

name
String

The name of the SiteMapProvider to find.

Property Value

A SiteMapProvider that represents a SiteMapProviderCollection element.

Examples

The following code example demonstrates how to use the Item[] property to retrieve the default ASP.NET SiteMapProvider object from the SiteMapProviderCollection object that is returned when the Providers collection is accessed.

C#
// Retrive the SiteMapProviderCollection that contains 
// the providers currently in use.
SiteMapProviderCollection providers = SiteMap.Providers;

// Use the Indexer to retrieve the default provider for ASP.NET.
SiteMapProvider defaultProvider = providers["AspNetXmlSiteMapProvider"];

Remarks

You can use the indexer to iterate over the contents of a SiteMapProviderCollection object.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also