RepeaterItemCollection 类  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 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。  |