I would like to know how can I query an array of objects. For example I have an array object like CarList. So CarList[0] would return me the object Car. Car has properties Model and Make. Now, I want to use linq to query the array CarList to get the Make of a Car whose Model is say "bmw". I tried the following
var carMake = from item in CarList where item .Model == "bmw" select s.Make;
I get the error
Could not find an implementation of the query pattern for source type CarList[]
I cannot change CarList from array to something like List<> since CarList is retured to me as array from a webservice.
Kindly let me know how this can be solved. Would be great if you can explain using C# code.
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…