filtering a list using LINQ

后端 未结 5 1454
面向向阳花
面向向阳花 2020-12-09 14:38

i have a list of project objects:

IEnumerable projects

a Project class as a property called Tags

5条回答
  •  庸人自扰
    2020-12-09 15:06

    Based on http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b,

    EqualAll is the approach that best meets your needs.

    public void Linq96() 
    { 
        var wordsA = new string[] { "cherry", "apple", "blueberry" }; 
        var wordsB = new string[] { "cherry", "apple", "blueberry" }; 
    
        bool match = wordsA.SequenceEqual(wordsB); 
    
        Console.WriteLine("The sequences match: {0}", match); 
    } 
    

提交回复
热议问题