ListView.ListViewItemCollection.Find(String, Boolean) 方法

定义

搜索名称与指定键匹配的项,也可以选择搜索子项。Searches for items whose name matches the specified key, optionally searching subitems.

public:
 cli::array <System::Windows::Forms::ListViewItem ^> ^ Find(System::String ^ key, bool searchAllSubItems);
public System.Windows.Forms.ListViewItem[] Find (string key, bool searchAllSubItems);
member this.Find : string * bool -> System.Windows.Forms.ListViewItem[]
Public Function Find (key As String, searchAllSubItems As Boolean) As ListViewItem()

参数

key
String

要搜索的项名称。The item name to search for.

searchAllSubItems
Boolean

若要搜索子项,则为 true;否则为 falsetrue to search subitems; otherwise, false.

返回

ListViewItem[]

匹配项;如果没有匹配项,则为一个空数组。The matching items, or an empty array if no items matched.

例外

仅适用于 .NET 5.0 和更高版本:keynull 或空字符串。.NET 5.0 and later versions only: key is null or the empty string.

注解

密钥比较不区分大小写。The key comparison is not case-sensitive. Name属性对应于中的的键 ListViewItem ListView.ListViewItemCollectionThe Name property corresponds to the key for a ListViewItem in the ListView.ListViewItemCollection.

适用于