WizardStepCollection WizardStepCollection WizardStepCollection WizardStepCollection Class

定义

表示控件中用作向导的 WizardStepBase 派生类的集合。Represents a collection of WizardStepBase-derived objects in a control that acts as a wizard. 此类不能被继承。This class cannot be inherited.

public ref class WizardStepCollection sealed : System::Collections::IList
public sealed class WizardStepCollection : System.Collections.IList
type WizardStepCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public NotInheritable Class WizardStepCollection
Implements IList
继承
WizardStepCollectionWizardStepCollectionWizardStepCollectionWizardStepCollection
实现

示例

下面的示例演示如何使用声明性WizardStepCollection语法填充集合。The following example demonstrates how to populate the WizardStepCollection collection using declarative syntax.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <asp:Wizard id="Wizard1" 
        runat="server" >
        <WizardSteps>
          <asp:WizardStep id="Step1" 
            runat="server" 
            title="Step 1">
          </asp:WizardStep>
          <asp:WizardStep id="Step2" 
            runat="server" 
            title="Step 2">
          </asp:WizardStep>
          <asp:WizardStep id="Step3" 
            runat="server" 
            title="Step 3">
          </asp:WizardStep>
          <asp:WizardStep id="Step4" 
            runat="server" 
            title="Step 4">
          </asp:WizardStep>
          <asp:WizardStep id="Step5" 
            runat="server" 
            title="Step 5">
          </asp:WizardStep>
          <asp:WizardStep id="Step6" 
            runat="server" 
            title="Step 6">
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>WizardStepCollection Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <asp:Wizard id="Wizard1" 
        runat="server" >
        <WizardSteps>
          <asp:WizardStep id="Step1" 
            runat="server" 
            title="Step 1">
          </asp:WizardStep>
          <asp:WizardStep id="Step2" 
            runat="server" 
            title="Step 2">
          </asp:WizardStep>
          <asp:WizardStep id="Step3" 
            runat="server" 
            title="Step 3">
          </asp:WizardStep>
          <asp:WizardStep id="Step4" 
            runat="server" 
            title="Step 4">
          </asp:WizardStep>
          <asp:WizardStep id="Step5" 
            runat="server" 
            title="Step 5">
          </asp:WizardStep>
          <asp:WizardStep id="Step6" 
            runat="server" 
            title="Step 6">
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>WizardStepCollection Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>

下面的示例演示如何以编程方式填充WizardStepCollection集合。The following example demonstrates how to programmatically populate a WizardStepCollection collection.

<%@ Page Language="C#" CodeFile="WizardStepCollection.cs" Inherits="WizardStepCollectioncs_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardStepCollection Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardStepCollection Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </form>
  </body>
</html>
<%@ Page Language="VB" CodeFile="WizardStepCollection.vb" Inherits="WizardStepCollectionvb_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardStepCollection Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardStepCollection Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </form>
  </body>
</html>

下面是前面示例中网页的代码隐藏文件。The following is the code-behind file for the Web page in the preceding example.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WizardStepCollectioncs_aspx : System.Web.UI.Page
{ 

    void Page_Load(object sender, EventArgs e)
    {
        // Programmatically create a wizard control.
        Wizard Wizard1 = new Wizard();

        // Create steps for the wizard control and insert them
        // into the WizardStepCollection collection.
        for (int i = 0; i <= 5; i++)
        {
            WizardStepBase newStep = new WizardStep();
            newStep.ID = "Step" + (i + 1).ToString();
            newStep.Title = "Step " + (i + 1).ToString();
            Wizard1.WizardSteps.Add(newStep);
        }

        // Display the wizard control on the Web page.
        PlaceHolder1.Controls.Add(Wizard1);
    }
    
}
Partial Class WizardStepCollectionvb_aspx
    Inherits System.Web.UI.Page

    Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        ' Programmatically create a wizard control.
        Dim Wizard1 As Wizard = New Wizard()

        ' Create steps for the wizard control and insert them
        ' into the WizardStepCollection collection.
        For i As Integer = 0 To 5
            Dim newStep As WizardStepBase = New WizardStep()
            newStep.ID = "Step" + (i + 1).ToString()
            newStep.Title = "Step " + (i + 1).ToString()
            Wizard1.WizardSteps.Add(newStep)
        Next

        ' Display the wizard control on the Web page.
        PlaceHolder1.Controls.Add(Wizard1)

    End Sub

End Class

注解

类用于存储和管理CreateUserWizard作为向导 (如控件或WizardStepBase Wizard控件) 的控件中派生的对象的集合。 WizardStepCollectionThe WizardStepCollection class is used to store and manage a collection of WizardStepBase-derived objects in a control that acts as a wizard, such as the CreateUserWizard control or the Wizard control. 例如, Wizard控件WizardStepCollection使用类作为其WizardSteps属性。For example, the Wizard control uses the WizardStepCollection class for its WizardSteps property.

可以通过多种方式访问WizardStepBase WizardStepCollection中派生的对象:There are multiple ways you can access the WizardStepBase-derived objects in the WizardStepCollection:

属性

Count Count Count Count

获取 WizardStepBase 控件的 Wizard 集合中从 WizardStepCollection 派生的对象数。Gets the number of WizardStepBase-derived objects in the Wizard control's WizardStepCollection collection.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示是否可修改集合中从 WizardStepBase 派生的对象。Gets a value indicating whether the WizardStepBase-derived objects in the collection can be modified.

IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,该值指示对集合的访问是否为同步的(线程安全)。Gets a value indicating whether access to the collection is synchronized (thread-safe).

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

从集合中的指定索引处获取从 WizardStepBase 派生的对象。Gets a WizardStepBase-derived object from the collection at the specified index.

SyncRoot SyncRoot SyncRoot SyncRoot

获取可用于同步对集合的访问的对象。Gets an object that can be used to synchronize access to the collection.

方法

Add(WizardStepBase) Add(WizardStepBase) Add(WizardStepBase) Add(WizardStepBase)

将指定的从 WizardStepBase 派生的对象追加到集合的结尾。Appends the specified WizardStepBase-derived object to the end of the collection.

AddAt(Int32, WizardStepBase) AddAt(Int32, WizardStepBase) AddAt(Int32, WizardStepBase) AddAt(Int32, WizardStepBase)

将指定的从 WizardStepBase 派生的对象添加到集合中的指定索引位置。Adds the specified WizardStepBase-derived object to the collection at the specified index location.

Clear() Clear() Clear() Clear()

从集合中移除所有从 WizardStepBase 派生的对象。Removes all WizardStepBase-derived objects from the collection.

Contains(WizardStepBase) Contains(WizardStepBase) Contains(WizardStepBase) Contains(WizardStepBase)

确定 WizardStepCollection 集合是否包含一个特定的从 WizardStepBase 派生的对象。Determines whether the WizardStepCollection collection contains a specific WizardStepBase-derived object.

CopyTo(WizardStepBase[], Int32) CopyTo(WizardStepBase[], Int32) CopyTo(WizardStepBase[], Int32) CopyTo(WizardStepBase[], Int32)

WizardStepCollection 集合中的所有项复制到兼容的、WizardStepBase 对象的一维数组,从目标数组的指定索引处开始。Copies all the items from a WizardStepCollection collection to a compatible one-dimensional array of WizardStepBase objects, starting at the specified index in the target array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回 IEnumerator 实现的对象,该对象可用于循环访问集合中从 WizardStepBase 派生的对象。Returns an IEnumerator-implemented object that can be used to iterate through the WizardStepBase-derived objects in the collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IndexOf(WizardStepBase) IndexOf(WizardStepBase) IndexOf(WizardStepBase) IndexOf(WizardStepBase)

确定索引值,该值表示集合中指定的从 WizardStepBase 派生的对象。Determines the index value that represents the position of the specified WizardStepBase-derived object in the collection.

Insert(Int32, WizardStepBase) Insert(Int32, WizardStepBase) Insert(Int32, WizardStepBase) Insert(Int32, WizardStepBase)

将指定的从 WizardStepBase 派生的对象插入集合中的指定索引位置。Inserts the specified WizardStepBase-derived object into the collection at the specified index location.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(WizardStepBase) Remove(WizardStepBase) Remove(WizardStepBase) Remove(WizardStepBase)

从集合中移除指定的从 WizardStepBase 派生的对象。Removes the specified WizardStepBase-derived object from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

移除集合中位于指定位置的从 WizardStepBase 派生的对象。Removes the WizardStepBase-derived object from the collection at the specified location.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

WizardStepCollection 集合中的所有项复制到一维数组,从目标数组的指定索引处开始。Copies all the items from a WizardStepCollection collection to a one-dimensional array, starting at the specified index in the target array.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

将指定对象追加到集合的结尾。Appends the specified object to the end of the collection.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

确定集合是否包含指定对象。Determines whether the collection contains the specified object.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

确定索引值,该值表示指定对象在集合中的位置。Determines the index value that represents the position of the specified object in the collection.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

将指定的对象插入集合中的指定位置。Inserts the specified object in the collection at the specified position.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

获取一个值,该值指示集合是否具有固定大小。Gets a value indicating whether the collection has a fixed size.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

获取集合中指定索引处的对象。Gets the object at the specified index in the collection.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

从集合中移除指定的对象。Removes the specified object from the collection.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅