Search item into list by passing another list with where ?

Jan 17 2014 7:24 AM
Hi,
 
I am trying to search the item into list by passing another list with where condition using linq.
here is my code:
 
public class ClassItemA
{
public string item { get; set; }
public short count { get; set; }
}
public class ClassItemB
{
public string item { get; set; }
}
class Program
{
static void Main(string[] args)
{

List<ClassItemA> b = new List<ClassItemA>();
string[] s = { "B00B0YJQPK", "B0046HF4AY" };
string[] s1 = { "B00BGL8YWS", "B0006G4MH0" };
foreach (string sb in s)
{
ClassItemA cb = new ClassItemA();
cb.item = sb.ToString();
cb.count = 10;
b.Add(cb);
}
foreach (string sb in s1)
{
ClassItemA cb = new ClassItemA();
cb.item = sb.ToString();
cb.count = 0;
b.Add(cb);
}
List<ClassItemB> c = new List<ClassItemB>();
string[] s2 = { "B00B0YJQPK", "B0046HF4AY", "B00BGL8YWS", "B0006G4MH0" };
foreach (string sb in s2)
{
ClassItemB cc = new ClassItemB();
cc.item = sb.ToString();
c.Add(cc);

}


Console.ReadLine();
}
 
--
Now I have to write a linq to get the items form classItemB object where items from ClassItemA which has count > 0.
Please suggest. 
 

Answers (3)