'ObservableCollection' could not be found even when using 'System.Collections.ObjectModel'

元气小坏坏 提交于 2019-12-22 18:39:31

问题


System.Collections.ObjectModel is included. Visual studio 2012 still says Type or namespace name 'ObservableCollection' could not be found.

Similar to this question

Code:

class ObservableClass : ObservableCollection<OtherClass>
{
}

EDIT: This is .NET Framework 3.5 and is a console application


回答1:


You're probably missing an assembly reference... depending on which framework you are targeting, this class might be found:

  • in WindowsBase.dll (.NET 3.x)
  • in System.dll (.NET 4.x)
  • in System.Windows.dll (Silverlight/Windows Phone 7)
  • in System.ObjectModel.dll (WinRT) (included in ".NET for Windows Store apps")


来源:https://stackoverflow.com/questions/12570902/observablecollection-could-not-be-found-even-when-using-system-collections-ob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!