共用方式為


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 查看 物件的內容。

適用於

另請參閱