本文整理汇总了C#中System.Windows.Forms.ListViewItem.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem.ToList方法的具体用法?C# ListViewItem.ToList怎么用?C# ListViewItem.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListViewItem
的用法示例。
在下文中一共展示了ListViewItem.ToList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchTypesName
/// <summary>
/// Search for type name.
/// </summary>
/// <param name="list">Array of items where to search.</param>
/// <param name="filter">Filter to search.</param>
/// <returns><c>true</c>, if call succeded, <c>false</c> otherwise.</returns>
bool SearchTypesName(ListViewItem[] list, string filter)
{
// return null if list is null
if (list == null) return false;
// return if filter is empty
if (string.IsNullOrEmpty(filter)) {
resultList = list.ToList();
return true;
}
// clear result
resultList.Clear();
// scan the list
for (int i = 0; i < list.Length; ++i) {
ListViewItem item = list[i];
DomAssemblyName asm = item.Tag as DomAssemblyName;
// search path
if (asm.FullName.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0)
resultList.Add(item);
else {
if (worker.CancellationPending)
return false;
// search using Mono.Cecil the class/interface/structs names
AssemblyDefinition currentAssembly;
if(!assembliesCache.ContainsKey(asm.FullName)) {
try {
currentAssembly = resolver.Resolve(asm.FullName);
}
catch {
continue;
}
assembliesCache.Add(asm.FullName, currentAssembly);
}
else
currentAssembly = assembliesCache[asm.FullName];
// search types in modules
if (currentAssembly != null) {
foreach(var module in currentAssembly.Modules)
foreach (var type in module.Types)
if (type.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0 &&
!resultList.Contains(item))
resultList.Add(item);
}
// report
worker.ReportProgress((int)(((i * 1.0) / list.Length) * 100));
}
}
return true;
}