SiteMapProviderCollection.Item[String] 属性

定义

从提供程序集合获取具有特定名称的 SiteMapProvider 对象。

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

参数

name
String

要查找的 SiteMapProvider 的名称。

属性值

表示 SiteMapProvider 元素的 SiteMapProviderCollection

示例

下面的代码示例演示如何使用 Item[] 属性从SiteMapProviderCollection访问集合时Providers返回的 对象检索默认的 ASP.NET SiteMapProvider 对象。

// 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")

注解

可以使用索引器循环访问对象的内容 SiteMapProviderCollection

适用于

另请参阅