本文整理汇总了C#中ISet.All方法的典型用法代码示例。如果您正苦于以下问题:C# ISet.All方法的具体用法?C# ISet.All怎么用?C# ISet.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISet
的用法示例。
在下文中一共展示了ISet.All方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
/// <summary>
/// Search the source with a given set of filtering tags.
/// </summary>
/// <param name="tags">Set of filtering tags.</param>
/// <returns>List of filtered code snippets.</returns>
public IList<CodeSnippet> Search(ISet<string> tags)
{
// ReSharper disable ImplicitlyCapturedClosure
if (CodeSnippets == null || CodeSnippets.Count == 0)
return new List<CodeSnippet>();
if (TagPreprocessor != null)
tags = TagPreprocessor.Preprocess(tags);
return
(TagMatcher != null)
? (from codeSnippet in CodeSnippets
let codeSnippetTags =
TagPreprocessor != null
? TagPreprocessor.Preprocess(codeSnippet.AllTags)
: codeSnippet.AllTags
where tags.All(filteringTag => codeSnippetTags.Any(tag => TagMatcher(filteringTag, tag)))
select codeSnippet).ToList()
: (from codeSnippet in CodeSnippets
let codeSnippetTags =
TagPreprocessor != null
? TagPreprocessor.Preprocess(codeSnippet.AllTags)
: codeSnippet.AllTags
where tags.IsSubsetOf(codeSnippetTags)
select codeSnippet).ToList();
// ReSharper restore ImplicitlyCapturedClosure
}