The union of two observed elements

I have two Observable collections that I need to merge into one collection.

This is because I have two methods: getTasks (staffID), which returns an ObservableCollection and getTasks (teamID), which selects staff and discards staff tasks.

For teams, I will have some small observable elements, I just want to combine them.

+4
source share
3 answers

I found a link to the CompositeCollection to another SO article: Joint ObservableCollection

Since you want to do Concat / Union, this seems to be doing just that. It is a pity that he did not score much.

+5
source

This is what worked for me:

Concat or Union, but the result is IEnumerable, so you need to convert it back to ObservableCollection:

var result = new ObservableCollection<T>(list1.Concat(list2)); 
+5
source

I went with the offer of volkerK, and then went on to:

http://msdn.microsoft.com/en-us/library/system.linq.enumerable.union.aspx Ta

+1
source

All Articles