Thanks to both of you for the help.
You are right, and I think the only way I've got is to do what Joe
suggested, i.e looping through the elements.

Thanks

On 24 mar, 17:46, tomilay <[email protected]> wrote:
> What you are actually doing is trying to cast an IList into a List
> (casting an interface into a concrete object).  This seems odd to me.
> What happens if you try
>
> IList<Post> myPosts = posts;
>
> I am just doing mental arithmetic here since my .NET environment is
> down and am unable to make more specific suggestions.
>
> 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 ?

Reply via email to