SiteMapProviderCollection.AddArray(SiteMapProvider[]) 方法

定義

使用 SiteMapProvider 屬性做為索引鍵,將 Name 物件的陣列加入至提供者集合。Adds an array of SiteMapProvider objects into the provider collection using the Name properties as keys.

public:
 void AddArray(cli::array <System::Web::SiteMapProvider ^> ^ providerArray);
public void AddArray (System.Web.SiteMapProvider[] providerArray);
member this.AddArray : System.Web.SiteMapProvider[] -> unit
Public Sub AddArray (providerArray As SiteMapProvider())

參數

providerArray
SiteMapProvider[]

要新增的 SiteMapProvider 物件陣列。The array of SiteMapProvider objects to add.

例外狀況

具有相同名稱的 SiteMapProvider 已經存在於 SiteMapProviderCollection 中。A SiteMapProvider with the same name already exists in the SiteMapProviderCollection.

providerArraynullproviderArray is null.

備註

SiteMapProviderCollection由屬性傳回的 Providers 是唯讀的。The SiteMapProviderCollection that is returned by the Providers property is read-only. 基於這個理由,您無法使用 AddAddArray 方法,在執行時間以程式設計方式加入其他提供者。For this reason, you cannot use the Add and AddArray methods to add additional providers programmatically at run time. 因此, Add 只有在 AddArray 您手動建立網站地圖提供者物件,並使用類別的實例來管理它們時,才會使用和方法 SiteMapProviderCollectionTherefore, the Add and AddArray methods are only used in scenarios where you manually create site map provider objects and manage them with an instance of the SiteMapProviderCollection class.

因為 SiteMap 類別是靜態的,所以任何 SiteMapProvider 包含在它的集合中的都會 Providers 保留在 Web 應用程式的存留期內。Because the SiteMap class is static, any SiteMapProvider contained in its Providers collection remains for the lifetime of the Web application.

適用於

另請參閱