DataColumnMappingCollection.Count 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取集合中 DataColumnMapping 对象的数量。
public:
property int Count { int get(); };
[System.ComponentModel.Browsable(false)]
public int Count { get; }
[System.ComponentModel.Browsable(false)]
[System.Data.DataSysDescription("DataColumnMappings_Count")]
public int Count { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Count : int
[<System.ComponentModel.Browsable(false)>]
[<System.Data.DataSysDescription("DataColumnMappings_Count")>]
member this.Count : int
Public ReadOnly Property Count As Integer
属性值
集合中项的数目。
实现
- 属性
示例
以下示例创建一个 DataColumnMappingCollection 集合,将对象添加到 DataColumnMapping 集合,并显示映射的源列的列表。
public void CreateColumnMappings()
{
DataColumnMappingCollection mappings =
new DataColumnMappingCollection();
mappings.Add("Category Name","DataCategory");
mappings.Add("Description","DataDescription");
mappings.Add("Picture","DataPicture");
string message = "ColumnMappings:\n";
for(int i=0;i < mappings.Count;i++)
{
message += i.ToString() + " "
+ mappings[i].ToString() + "\n";
}
Console.WriteLine(message);
}
Public Sub CreateColumnMappings()
Dim mappings As New DataColumnMappingCollection()
mappings.Add("Category Name", "DataCategory")
mappings.Add("Description", "DataDescription")
mappings.Add("Picture", "DataPicture")
Dim message As String = "ColumnMappings:" + ControlChars.Cr
Dim i As Integer
For i = 0 To mappings.Count - 1
message += i.ToString() + " " + mappings(i).ToString() _
+ ControlChars.Cr
Next i
Console.WriteLine(message)
End Sub