WebPartZoneCollection.Contains(WebPartZoneBase) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳一個值,表示集合中是否存在特定區域。
public:
bool Contains(System::Web::UI::WebControls::WebParts::WebPartZoneBase ^ value);
public bool Contains(System.Web.UI.WebControls.WebParts.WebPartZoneBase value);
member this.Contains : System.Web.UI.WebControls.WebParts.WebPartZoneBase -> bool
Public Function Contains (value As WebPartZoneBase) As Boolean
參數
- value
- WebPartZoneBase
WebPartZone A 會被檢查以判斷它是否在集合中。
傳回
一個布林值,表示某個特定區域是否屬於集合。
範例
以下程式碼範例示範了此 Contains 方法的使用。 範例的完整程式碼,包括使用者控制項、包含區域的頁面,以及包含該程式碼的部分類別檔案,皆可在類別總覽的 WebPartZoneCollection 範例部分找到。
以下程式碼段落示範該 Contains 方法的使用方式。 要執行程式碼,請在瀏覽器載入該頁面,然後點擊 Coll. Contains WebPartZone2 按鈕。
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = String.Empty;
Label1.Text = mgr.Zones.Contains(WebPartZone2).ToString();
}
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
Label1.Text = String.Empty
Label1.Text = mgr.Zones.Contains(WebPartZone2).ToString()
End Sub
備註
此 Contains 方法能讓你檢查特定 WebPartZone 物件,判斷它是否屬於 WebPartZoneCollection 集合中。