Reputation: 1
i have a list - finalbetfile2
The class is,
class finalbetfile
{
public int[] BetInfo{ get; set; }
public string TransID { get; set; }
public string BetAmount { get; set; }
public string TransDateTime { get; set; }
}
The BetInfo
column has six integers values,
I want to match the Betinfo
with my rank3of1
(Result) with any order,the code is given below
var rank3of1 = new int[] { intball1, intball2, intball3, intball4, intball5, intball6 };
var filteredProjects8 = finalbetfile2.Where(p => rank3of1.All(tag => p.BetInfo.Contains(tag)));
It works fine but matching against all 6 numbers instead of at least 5.
Upvotes: 0
Views: 94
Reputation: 109185
Use Intersect
:
var filteredProjects8 = finalbetfile2
.Where(p => rank3of1.Intersect(p.BetInfo).Count() >= 5);
Upvotes: 2