In almost all examples, POCO classes created for Entity Framework 4.1 are defined using the ICollection interface:
public class TravelTicket { public virtual int Id { get; set; } public string Destination { get; set; } public virtual ICollection<Person> Members { get; set; } }
However, this causes a problem in my code where I need to access a collection member by index, for example:
Person Paul = TravelTicket.Members [3];
Cannot apply indexing with [] to an expression like "System.Collections.Generic.ICollection
So, how do I get around this problem, and should I always use ICollection for my POCO collections?
source share