RepeaterItemCollection 類別

定義

代表 RepeaterItem 控制項中 Repeater 物件的集合。 此類別無法獲得繼承。

public ref class RepeaterItemCollection sealed : System::Collections::ICollection
public sealed class RepeaterItemCollection : System.Collections.ICollection
type RepeaterItemCollection = class
    interface ICollection
    interface IEnumerable
Public NotInheritable Class RepeaterItemCollection
Implements ICollection
繼承
RepeaterItemCollection
實作

範例

      void Page_Load(Object Sender, EventArgs e)
      {
if (!IsPostBack)
{
   ArrayList myDataSource = new ArrayList();

   myDataSource.Add(new PositionData("Item 1", "$6.00"));
   myDataSource.Add(new PositionData("Item 2", "$7.48"));
   myDataSource.Add(new PositionData("Item 3", "$9.96"));
   
   // Initialize the RepeaterItemCollection using the ArrayList as the data source.
   RepeaterItemCollection myCollection = new RepeaterItemCollection(myDataSource);
   myRepeater.DataSource = myCollection;
   myRepeater.DataBind();
}
      }
Sub Page_Load(Sender As Object, e As EventArgs)
   If Not IsPostBack Then
      Dim myDataSource As New ArrayList()

      myDataSource.Add(New PositionData("Item 1", "$6.00"))
      myDataSource.Add(New PositionData("Item 2", "$7.48"))
      myDataSource.Add(New PositionData("Item 3", "$9.96"))

      ' Initialize the RepeaterItemCollection using the ArrayList as the data source.
      Dim myCollection As New RepeaterItemCollection(myDataSource)
      myRepeater.DataSource = myCollection
      myRepeater.DataBind()
   End If
End Sub 'Page_Load

備註

類別 RepeaterItemCollection 代表 物件的集合 RepeaterItem ,接著代表 控制項中的資料 Repeater 項。 若要以程式設計方式從 Repeater 控制項擷取 RepeaterItem 物件,請使用下列其中一種方法:

  • 使用索引子,使用陣列標記法從集合中取得單 RepeaterItem 一物件。

  • CopyTo使用 方法將集合 System.Array 的內容複寫到 物件,然後可用來從集合取得專案。

  • GetEnumerator使用 方法來建立 System.Collections.IEnumerator 介面,然後可用來從集合中取得專案。

  • 使用 foreach (C#) 或 For Each (Visual Basic) 逐一查看集合。

屬性 Count 會指定集合中的專案總數,通常用來判斷集合的上限。

建構函式

RepeaterItemCollection(ArrayList)

初始化 RepeaterItemCollection 類別的新執行個體。

屬性

Count

取得集合中 RepeaterItem 物件的數目。

IsReadOnly

取得值,指出是否可以修改 RepeaterItem 中的RepeaterItemCollection 物件。

IsSynchronized

取得值,指出 RepeaterItemCollection 的存取是否為同步處理 (安全執行緒)。

Item[Int32]

取得集合中位於指定索引的 RepeaterItem 物件。

SyncRoot

取得可用來同步存取 RepeaterItemCollection 集合的物件。

方法

CopyTo(Array, Int32)

將全部項目從 RepeaterItemCollection 物件中所指定索引開始,自這個 Array 複製到指定的 Array 物件。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

傳回 IEnumerator 介面,可逐一查看 RepeaterItem 中的所有 RepeaterItemCollection 物件。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱