WebPartZoneCollection.Contains(WebPartZoneBase) 方法

定义

返回一个值,该值指示集合中是否存在特定区域。Returns a value indicating whether a particular zone exists in the collection.

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

要对其进行检查以确定是否位于集合中的 WebPartZoneA WebPartZone that is checked to determine whether it is in the collection.

返回

一个布尔值,该值指示集合中是否存在特定区域。A Boolean value that indicates whether a particular zone is in the collection.

示例

下面的代码示例演示Contains方法的用法。The following code example demonstrates the use of the Contains method. WebPartZoneCollection类概述的 "示例" 部分中提供了此示例的完整代码, 包括用户控件、包含这些区域的页面以及包含代码的分部类文件。The complete code for the example, including a user control, a page containing the zones, and a partial class file that contains the code, is found in the Example section of the WebPartZoneCollection class overview.

下面的代码部分演示Contains方法的用法。The following section of code demonstrates usage of the Contains method. 若要执行代码, 请在浏览器中加载页面, 然后单击 "Coll"。包含 WebPartZone2按钮。To execute the code, load the page in a browser, and click the Coll. Contains WebPartZone2 button.

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集合中。The Contains method enables you to check a particular WebPartZone object and determine whether it is in a WebPartZoneCollection collection.

适用于

另请参阅