本文整理汇总了C#中System.Windows.Forms.CheckedListBox.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# CheckedListBox.Cast方法的具体用法?C# CheckedListBox.Cast怎么用?C# CheckedListBox.Cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.CheckedListBox
的用法示例。
在下文中一共展示了CheckedListBox.Cast方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdvancedFilter
public void AdvancedFilter(string searchString, CheckedListBox.CheckedItemCollection checkedItems)
{
// Start from scratch
gridView.Items.Clear();
// Repopulate if empty search
if (checkedItems.Count == 0 || searchString == "")
{
fullList.ForEach(item => gridView.Items.Add(item));
return;
}
// For each video file showing:
fullList.ForEach(item =>
{
// Big Linq Statement Translation:
// - Find tag entries from file that match type of checked items
// - Any entry that contains the search string, add that file to view
var file = (VideoFile)item.Tag;
if (checkedItems.Cast<Tag>().Select(tag =>
file.Tags.Find(entry => entry.TypeId == tag.Id)).
Any(match => match != null && match.Data.ToLower().Contains(searchString.ToLower())))
{
gridView.Items.Add(item);
}
});
}
示例2: GetProgramsQueueFromCheckedListControl
public static Queue<DownloadableProgram> GetProgramsQueueFromCheckedListControl(CheckedListBox.CheckedItemCollection items)
{
var downloadLinksResult = new Queue<DownloadableProgram>();
var downloadLinks = items.Cast<DownloadableProgram>();
downloadLinks.ForEach(dl => downloadLinksResult.Enqueue(dl));
return downloadLinksResult;
}