c# - Searching item in List -
When an item search Using This does not return any results.
man [] PRN = new Person [] {new Person {Name = "Robert", RList = {new ReceipeList {NameofRecipie = "Coak"}, new ReceipeList {NameofRecipie = "pizza"}}}, new person {name = "Rahim", RList = {new ReceipeList {NameofRecipie = "Coak"}, new ReceipeList {NameofRecipie = "OnionBread "}}},};
ReceipeList lstr = new ReceipeList (); Lstr.NameofRecipie = "Coak";
lst select var query = from lst in PRN where (lst.RList.Contains (lstr));
foreach (query v v) {ordered: (v.Name.ToString (+) + ';); foreach (ReceipeList lst in v.RList) {Console. Write (lst.NameofRecipie.ToString () + ",");} console. Wrightite ();}
This is not working because you search for a specific example (by reference). For this reason, your query will return only those values which will have an example of your typical continent institution, and not An empty list that you are specifying, the same With Uly.
You can achieve this task ReceiptList, or double again to your query:
string lstr = "coak"; Var query = in Piaran where lst.RList.Any (r = & gt; r.NameofRecipie == lstr) Select lst;
this works because instead of looking for a specific example, ReceipeList uses the method () to find instances by a prediction.
Comments
Post a Comment