DataView.Find 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
按指定的排序键值查找行 DataView 。
重载
| 名称 | 说明 |
|---|---|
| Find(Object[]) |
按指定的排序键值查找行 DataView 。 |
| Find(Object) |
按指定的排序键值查找行 DataView 。 |
Find(Object[])
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
按指定的排序键值查找行 DataView 。
public:
int Find(cli::array <System::Object ^> ^ key);
public int Find(object?[] key);
public int Find(object[] key);
member this.Find : obj[] -> int
Public Function Find (key As Object()) As Integer
参数
返回
与指定的排序键值匹配的第一行 DataView 的位置的索引;否则,如果没有匹配的排序键值,则 -1。
示例
以下Visual Basic示例使用 Find 方法返回在其排序键列中包含指定值的行的索引。
Private Sub FindValueInDataView(table As DataTable)
Dim view As New DataView(table)
view.Sort = "Customers"
' Find the customer named "John Smith".
Dim vals(1) As Object
vals(0)= "John"
vals(1) = "Smith"
Dim i As Integer = view.Find(vals)
Console.WriteLine(view(i))
End Sub
另请参阅
适用于
Find(Object)
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
按指定的排序键值查找行 DataView 。
public:
int Find(System::Object ^ key);
public int Find(object? key);
public int Find(object key);
member this.Find : obj -> int
Public Function Find (key As Object) As Integer
参数
- key
- Object
要搜索的对象。
返回
包含指定的排序键值的行 DataView 的索引;否则,如果排序键值不存在,则 -1。
示例
以下Visual Basic示例使用 Find 方法返回包含所需排序键列中值的行的索引。
Private Sub FindValueInDataView(table As DataTable)
Dim view As New DataView(table)
view.Sort = "CustomerID"
' Find the customer named "DUMON" in the primary key column
Dim i As Integer = view.Find("DUMON")
Console.WriteLine(view(i))
End Sub