LINQ in Action roller

ToList<> Cast Exception

If I define a collection of Member objects like this: Code Snippet public class MemberCollection : List Member > { } ... and try to populate this collection using LINQ to SQL like this: Code Snippet public MemberCollection GetMembers() { using ( VenomDbDataContext db = new VenomDbDataContext ()) { return ( MemberCollection )( from m in db.Members orderby m.LastName, m.FirstName ascending select m).ToList Member >(); } } I get a wonderful exception like this: System.InvalidCastException: Unable to Read More...
Published Monday, January 28, 2008 9:06 PM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication