The type or namespace name 'ObservableCollection' could not be found
I am working with Entity Framework in asp.net c# framework 3.5 I have ge开发者_JAVA百科nerated entity classes using poco generator template. But I am getting following error:
The type or namespace name
ObservableCollection
could not be found (are you missing a using directive or an assembly reference?)
FYI System.Collections.ObjectModel
is also added in class.
What could be wrong? How to resolve it?
using System.Collections.ObjectModel;
Add WindowsBase to your reference.
@Riz Please ensure that your project has a reference to System.Windows as it appears that ObservableColletion is contained in System.Collections.ObjectModel namespace which is in System.Windows in .Net 4.0 and System.Collection.ObjectModel in .Net 3.0 & 3.5. It wasn't available before that. In silverlight it can be found in System.Collections.ObjectModel.
Make sure System.Data.Entity Dll is version 4... not 2. Looks like it exist only on .net framework 4.0
I think ObservableCollection only exists in .NET 4.0.
精彩评论