I want to get a list of string based in two lists lstJobs and lstPraudits. I want to get PlanId which is common in both list.
Here is my code-
List<string> result = reviewModel.lstJobs.Select(x=> x.PlanId) .Intersect(reviewModel.lstPraudits.Select(y=> y.PlanId)) .ToList();
What I am doing wrong here
Your approach is wrong because
x.planId.Contains will search substrings and you are passing a list to the method. It's the wrong approach anyway because you don't want to compare substrings.