Using ObservableCollection in ASP.NET

I need to use the functionality that asp.net provides in my application. My only problem is that this class is part of the WindowsBase assembly and I'm not sure if it's a good idea to include the windows assembly in the web project. ObservableCollection

Any ideas / comments?

Thanks!

+2


a source to share


1 answer


If you have creative uses for ObservableCollection

outside WPF, I see no reason why you shouldn't use it. Even Microsoft says :

Before implementing your own collections, consider using ObservableCollection<T>

or one of the existing collection classes such as List<T>

, Collection<T>

and BindingList<T>

, among many others.



This article provides an example ObservableCollection

in WPF. However, the author makes this expression at the end of the article:

Although this app used the binding support provided by the ObservableCollection class and also responded to the CollectionChanged event to update the UI, you don't need to use the class this way. Since it notifies listeners that its content has changed, you can replace any List or Collection instance you are using with an ObservableCollection instance (even if you are not building a WPF application) and then hook up event handlers to notify clients that the collection's content has changed. ...

+5


a source







All Articles