In addition my previous post. What you are doing is attempting to convert and IList into a List. This casting is troublesome because while an List implements IList, not every IList is a List. That is the problem I see with your code. There is no way that the framework will know how to convert your IList into a list because such a casting violates the whole point of interfaces(they should not know about any classes that inherit them).
On Mar 20, 5:47 am, graphicsxp <[email protected]> wrote: > Hello, > > I've got two classes, CGMPost and MSMPost, which both inherits from a > class Post. > > I have a IList called 'posts' that contains a collection of CGMPost > and MSMPost entities. > > If I do that : > > List<Post> myPosts = posts as List<Post>; > > then myPosts is null (altough posts contains 7 entities of type > CGMPost and MSMPost). > > Why is that ?
