3

I am trying to make a abstract ObservableCollection class which requires its members to implement an interface IXMLEntity I also want the abstract class to implement this interface also -- the reasoning is that the Collection could then be XMLSerialized, and include all its children.

public abstract class BaseCollectionModel<T> : ObservableCollection<T>
    where T : IXMLEntity
{

}

How should I do this? I am just starting a new library for my project so any other design patterns are up for suggestions.

I plan on making BaseCollectionModel a class which is able to provide 'infinite scrolling' by making service calls for more items as necessary.

2 Answers 2

3

Have you tried the usual way?

public abstract class BaseCollectionModel<T> : ObservableCollection<T>, IXMLEntity
where T : IXMLEntity
{

}
2
  • 1
    Ah shoot, Had the ordering incorrect! Tried so many things, guess I missed that part ;p Nov 30, 2011 at 6:03
  • 1
    I do that all the time too. :>
    – dthorpe
    Nov 30, 2011 at 6:04
2

This should work:

public abstract class BaseCollectionModel<T> : ObservableCollection<T>, IXMLEntity
    where T : IXMLEntity
{

}
1
  • Ah shoot, Had the ordering incorrect! Tried so many things, guess I missed that part ;p Nov 30, 2011 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.