RepeaterItemCollection クラス
アセンブリ: System.Web (system.web.dll 内)
構文
解説RepeaterItemCollection クラスは RepeaterItem オブジェクトのコレクションを表し、このオブジェクトは Repeater コントロールのデータ項目を順番に表します。プログラムにより Repeater コントロールから RepeaterItem オブジェクトを取得するには、次のメソッドのいずれかを使用します。
-
CopyTo メソッドを使用して、コレクションの内容を System.Array オブジェクトにコピーします。その後、このオブジェクトを使用して、コレクションから項目を取得できます。
-
GetEnumerator メソッドを使用して System.Collections.IEnumerator インターフェイスを作成します。その後、このインターフェイスを使用して、コレクションから項目を取得できます。
-
コレクションを反復処理するには、foreach (C#) または For Each (Visual Basic) を使用します。
Count プロパティは、コレクション内の合計項目数を指定します。通常は、コレクションの上限を判断するために使用されます。
使用例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
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(); } }
継承階層System.Web.UI.WebControls.RepeaterItemCollection
スレッド セーフ
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照RepeaterItemCollection コンストラクタ
アセンブリ: System.Web (system.web.dll 内)
構文
解説
使用例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
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(); } }
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照RepeaterItemCollection プロパティ
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| Count | コレクション内の RepeaterItem オブジェクト数を取得します。 |
| IsReadOnly | RepeaterItemCollection 内の RepeaterItem オブジェクトを変更できるかどうかを示す値を取得します。 |
| IsSynchronized | RepeaterItemCollection へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。 |
| Item | コレクション内の指定したインデックス位置の RepeaterItem オブジェクトを取得します。 |
| SyncRoot | RepeaterItemCollection コレクションへのアクセスを同期するために使用できるオブジェクトを取得します。 |
参照RepeaterItemCollection メソッド
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| CopyTo | 指定した System.Array オブジェクトに RepeaterItemCollection のすべての項目をコピーします。コピー操作は、System.Array オブジェクトの指定したインデックス位置から始まります。 |
| Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
| GetEnumerator | RepeaterItemCollection 内のすべての RepeaterItem オブジェクトを反復処理できる System.Collections.IEnumerator インターフェイスを返します。 |
| GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
| GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
| ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
参照RepeaterItemCollection メンバ
Repeater コントロール内の RepeaterItem オブジェクトのコレクションを表します。このクラスは継承できません。
RepeaterItemCollection データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| Count | コレクション内の RepeaterItem オブジェクト数を取得します。 |
| IsReadOnly | RepeaterItemCollection 内の RepeaterItem オブジェクトを変更できるかどうかを示す値を取得します。 |
| IsSynchronized | RepeaterItemCollection へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。 |
| Item | コレクション内の指定したインデックス位置の RepeaterItem オブジェクトを取得します。 |
| SyncRoot | RepeaterItemCollection コレクションへのアクセスを同期するために使用できるオブジェクトを取得します。 |
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| CopyTo | 指定した System.Array オブジェクトに RepeaterItemCollection のすべての項目をコピーします。コピー操作は、System.Array オブジェクトの指定したインデックス位置から始まります。 |
| Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
| GetEnumerator | RepeaterItemCollection 内のすべての RepeaterItem オブジェクトを反復処理できる System.Collections.IEnumerator インターフェイスを返します。 |
| GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
| GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
| ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
参照- RepeaterItemCollectionのページへのリンク