1

I currently have a Silverlight project where I have separated out a common "library" for both the front and back ends to share. This library mostly includes primitive objects that are reused throughout both projects.

After sorting through the initial errors where Visual Studio complaints about different target framework families. (VS2010 Warning on project add, I am still getting an error when the service attempts to convert between the "Backend" ObservableCollection to the "Silverlight" ObservableCollection. Specifically I get the error:

Cannot implicitly convert type 'System.Collections.ObjectModel.ObservableCollection<int>' to 'System.Collections.ObjectModel.ObservableCollection`1<int>'   

Doing some digging, it seems to want to use the System.Windows dll rather than the System dll. They both seem to have a reference to the same object, but because they are from different dll files, they seem to be unhappy. Any thoughts on how to resolve this?

Here is a simple code example: In the Silverlight Library dll:

public class ObserverContainer<T>
{
    public ObservableCollection<T> IntPropertyCollection { get; set; }
}

In my web project:

[OperationContract]
public ObserverContainer<int> GetCollection()
{
    ObserverContainer<int> collection = new ObserverContainer<int>();
    collection.IntPropertyCollection = new ObservableCollection<int>();
    return collection;
}

Any thoughts?

Community
  • 1
  • 1
Aerophilic
  • 885
  • 2
  • 9
  • 22

0 Answers0