Results 1 to 2 of 2

Thread: ICollection to IEnumerable

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    ICollection to IEnumerable

    Hi All,

    My MVC App uses the Entity framework. The framework is sending back a an ICollection but I really want an IEnumerable.

    I have declared a public class on my view model with a public IEnumerable of my class type i.e.

    Code:
    Public class fred
    { contains my public properties }
    
    public IEnumerable<fred> EnumerableProp {get;set;}
    my Model returns an ICollection of type fred. How do I get fred into my EnumerableProp?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ICollection to IEnumerable

    Um, have you checked the documentation for the ICollection<T> interface?
    Quote Originally Posted by MSDN
    Code:
    public interface ICollection<T> : IEnumerable<T>, 
          IEnumerable
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width