Hi simple task
I have 2 collections need to create a 3 one if you like by merging the 2 and giving me a third one with all the unique items only
class Program
{
static void Main(string[] args)
{
ObservableCollection<Person> collectionA = new ObservableCollection<Person>
{
new Person {Id = 1, Name = "Name1", Surname = "Surname1"},
new Person {Id = 2, Name = "Name2", Surname = "Surname2"},
new Person {Id = 3, Name = "Name3", Surname = "Surname3"},
new Person {Id = 4, Name = "Name4", Surname = "Surname4"}
};
ObservableCollection<Person> collectionB = new ObservableCollection<Person>
{
new Person {Id = 5, Name = "Name5", Surname = "Surname5"},
new Person {Id = 2, Name = "Name2", Surname = "Surname2"},
new Person {Id = 6, Name = "Name6", Surname = "Surname6"},
new Person {Id = 4, Name = "Name4", Surname = "Surname4"}
};
ObservableCollection<Person> result=????
}
}
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
}
}
Any ideas?Thanks a lot
EDIT CLARIFICATION
I have collectionA, then I create collection B, compare the two collection add any item to FIND ALL THE ITEMS IN COLLECTIONB THAT DONT EXISTS IN COLLECTION A AND CREATE A RESULT COLLECTION.Hope clear now