Tech Off Post

Single Post Permalink

View Thread: How can I combine 2 ObservableCollections side by side?
  • User profile image

    Thanks for your response.  But I do not think HashSet will work for me.  I have provided additional info below.

    I have done a lot of studying on this and I believe that I now have a better understanding of what I need and how I should ask the question.  Although I have many, for the sake of simplicity I will only refer to 2 classes here as an example.  I am gathering data in real time.  The data is being processed and placed into ObservableCollection classes.  All classes will have the same number of data points.  Any class can have many duplicates.  The order of the data must not change.  I am looking for a way to somehow merge multiple classes together side by side so the resulting class can be used as a single data source with all properties combined when data binding to a WPF chart or datagrid.  I would like to do this without have to copy all of the data to the new object, something like a data view.  Here's what I mean by "merge multiple classes together side by side". 

    Starting with 2 ObservableCollection classes.  The first ObservableCollection is of objects with properties A, B and C and the second ObservableCollection is of objects with properties D and E.  I would like to be able to combine them into a single data source of A, B, C, D and E.  Hopefully as some kind of data view where the underlining data is accessed but not copied.  It seems that CompositeCollection just puts them on top of each other.