WebPartZoneCollection.Contains(WebPartZoneBase) 方法

定義

傳回值,指出集合中是否存在特定區域。

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,以判斷是否存在於集合中。

傳回

Boolean

布林值,指出集合中是否有特定區域。

範例

下列程式碼範例示範 如何使用 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

適用於

另請參閱