arrow_upward
[C#] ObservableCollection vs List
#1
there's no doubt that our app needs a dataset or a database, to keep that data in our app is using the ObservableCollection or List class.
Even though the List class is more easy and simple than the ObservableCollection class when combining with Linq (select, count, where, etc.), but I do use ObservableCollection in my WPF apps to keep more complex dataset.
so what do you guys think? ObservableCollection or List??



#2
ObservableCollection for data that needs to be used in a front-end with databinding and a List/Enumerable if it shouldnt imo.



#3
Agreed with bnapalm, if you don't need to bind it to UI then List should be obvious choice, and even if you need to bind it, it also kind of depends on the amount of data in the collection.



#4
It depends on more factors, what kind of data? what hardware are you on? how responsive do you want the fetch function to be etc