views:

208

answers:

1

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

Any ideas/comments?

Thanks!

+1  A: 

If you have a creative use for ObservableCollection outside of WPF, I don't see any reason you should not take advantage of it. Even Microsoft says:

Before implementing your own collection, 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 has an example of an ObservableCollection in WPF. However, the author makes this statement at the end of the article:

Although this application made use of the binding support provided by the ObservableCollection class and also reacted to its CollectionChanged event in order to update the user interface, you needn't use the class this way. Because it notifies listeners that its contents have changed, you can replace any List or Collection instance that you use with an ObservableCollection instance (even if you're not creating a WPF application) and then hook up event handlers to notify clients that the collection's contents have changed.

Robert Harvey
Robert, I explained why I was concerned about using ObservableCollection within my asp.net app - it's housed in the windows assembly.
Andrey
@Andrey:You have nothing to worry about. The assembly is just a collection of classes. See my edit.
Robert Harvey