แก้ไข

แชร์ผ่าน


SiteMapProviderCollection.Item[String] Property

Definition

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

public:
 property System::Web::SiteMapProvider ^ default[System::String ^] { System::Web::SiteMapProvider ^ get(System::String ^ name); };
public System.Web.SiteMapProvider this[string name] { get; }
member this.Item(string) : System.Web.SiteMapProvider
Default Public ReadOnly Property Item(name As String) As SiteMapProvider

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.

// 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"];

' Retrive the SiteMapProviderCollection that contains 
' the providers currently in use.
Dim providers As SiteMapProviderCollection 
providers = SiteMap.Providers

' Use the Indexer to retrieve the default provider for ASP.NET.
Dim defaultProvider As SiteMapProvider 
defaultProvider = providers("AspNetXmlSiteMapProvider")

Remarks

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

Applies to

See also