DataColumnCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
DataColumn の DataTable オブジェクトのコレクションを表します。
public ref class DataColumnCollection sealed : System::Data::InternalDataCollectionBase
public ref class DataColumnCollection : System::Data::InternalDataCollectionBase
public sealed class DataColumnCollection : System.Data.InternalDataCollectionBase
[System.Serializable]
public class DataColumnCollection : System.Data.InternalDataCollectionBase
type DataColumnCollection = class
inherit InternalDataCollectionBase
[<System.Serializable>]
type DataColumnCollection = class
inherit InternalDataCollectionBase
Public NotInheritable Class DataColumnCollection
Inherits InternalDataCollectionBase
Public Class DataColumnCollection
Inherits InternalDataCollectionBase
- 継承
- 属性
例
次の例では、オブジェクトの DataColumn コレクションを反復処理し、コレクション内の各列のさまざまなプロパティを出力します。
private void PrintDataTableColumnInfo(DataTable table)
{
// Use a DataTable object's DataColumnCollection.
DataColumnCollection columns = table.Columns;
// Print the ColumnName and DataType for each column.
foreach(DataColumn column in columns)
{
Console.WriteLine(column.ColumnName);
Console.WriteLine(column.DataType);
}
}
Private Sub PrintDataTableColumnInfo(table As DataTable)
' Use a DataTable object's DataColumnCollection.
Dim columns As DataColumnCollection = table.Columns
' Print the ColumnName and DataType for each column.
Dim column As DataColumn
For Each column in columns
Console.WriteLine(column.ColumnName)
Console.WriteLine(column.DataType.ToString)
Next
End Sub
注釈
次 DataColumnCollection に、a のスキーマを DataTable定義し、各データに含めることができるデータの種類を DataColumn 決定します。 オブジェクトのプロパティDataTableをDataColumnCollectionColumns介してアクセスできます。
メソッドDataColumnCollectionを使用してRemoveAddオブジェクトを挿入および削除DataColumnします。 このプロパティを Count 使用して、コレクション内のオブジェクトの数 DataColumn を確認します。 Contains指定したインデックスまたは列名がコレクションに存在するかどうかを確認するには、このメソッドを使用します。
プロパティ
Count |
コレクション内の要素の合計数を取得します。 (継承元 InternalDataCollectionBase) |
IsReadOnly |
InternalDataCollectionBase が読み取り専用かどうかを示す値を取得します。 (継承元 InternalDataCollectionBase) |
IsSynchronized |
InternalDataCollectionBase が同期されているかどうかを示す値を取得します。 (継承元 InternalDataCollectionBase) |
Item[Int32] |
指定したインデックス位置にある DataColumn をコレクションから取得します。 |
Item[String] |
指定した名前の DataColumn をコレクションから取得します。 |
List |
コレクションの項目をリストとして取得します。 |
List |
コレクションの項目をリストとして取得します。 (継承元 InternalDataCollectionBase) |
SyncRoot |
コレクションの同期をとるために使用できるオブジェクトを取得します。 (継承元 InternalDataCollectionBase) |
メソッド
events
CollectionChanged |
列の追加または削除によって列コレクションが変更されたときに発生します。 |
拡張メソッド
Cast<TResult>(IEnumerable) |
IEnumerable の要素を、指定した型にキャストします。 |
OfType<TResult>(IEnumerable) |
指定された型に基づいて IEnumerable の要素をフィルター処理します。 |
AsParallel(IEnumerable) |
クエリの並列化を有効にします。 |
AsQueryable(IEnumerable) |
IEnumerable を IQueryable に変換します。 |
適用対象
スレッド セーフ
この型は、マルチスレッド読み取り操作では安全です。 すべての書き込み操作を同期する必要があります。