Saturday 15 August 2015

c# - Compare sublist of a list for objects that change, in Linq -


I have a list of objects in which there is a sybbys of the string and these structures can change between the days and I'm looking to compare them to see if there was any change.

  public class recipe {public string id {get; Set; } Public string name {get; Set; } Public listing & lt; String & gt; Content {Received; Set; }}   

ID field is similar to the list's editions and content only wire .

  list & amp; Lt; Method & gt; List1 = GetRecipes ("2013-06-20"); & Lt; Recipe & gt; List2 = GetRecipes ("2013-06-21");   

I am trying to find all the cookie which is the component change between days i list2 in List 2 but not list1 , but being able to come up with a Linq statement to find the cookie for something like this

  var newRecipes = list1.Where (x =>! List2.Any (x1 => x1.id == x.id)). Union (list2.Where (x =>! List 1. some (x1 => x1.id == x.id)));   

But, I do not know yet how the cookie is selected, component between the list Change.

  var revised reset = list 1. Where (x => List2.Any (x1 = & gt; x1.id == x.id & x1.iGuentants.SuvenesAqualle (X.Engident)). Union (list2.Where (x =>! List1.Any (x1 => x1.id == x.id & amp; x1.Ingedients.SequenceEqual (x.Ingedients))));   

How can I get a list of objects that have been converted into string manipulations?

This code will add you to each non-matching recipients of the same ID. You have to sort the content list for the order task.

  var = Older in GetRecipes ("2013-06-20") to join new in GetRecipes ("2013-06-21") on the old. ID is equal to new. Id where! old. material. Select white aquals (new content) New {old, new};    

No comments:

Post a Comment