I'm using ObservableCollection in a portable library but I'm getting the error below. How can I solve this problem?
'System.Collections.ObjectModel.ObservableCollection
1<MyClass>' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Collections.ObjectModel.ObservableCollection
1' could be found (are you missing a using directive or an assembly reference?)
edited: I have this class in a portable library
Class A
{
public ObservableCollection<MyClass> MyList { get;set;}
}
and trying to use it in a WCF Service.
myA.MyList.Add(new MyClass());
Second Edit: I figured it out by putting my class having the observable collection property to a different project/library. But I'm still wondering why I got that strange error.
Another solution for this question would be a better solution structure for my projects. I'm still trying to manage it.
I am designing a Silverlight project consuming a WCF service. I have some common classes to share in both Silverlight and the WCF Service. I could not make it work by using just a portable class and share because I need some data structures to use like ObservableCollection and SortedList etc. Portable classes do not have this. Because of that reason I am having Surrogate classes in different libraries but this doesnt look good. How should I design it?