The performance implications of IEnumerable vs. IQueryable
It all started innocently enough. I was implementing a "Older Posts/Newer Posts" feature for my new web site and was writing code like this:IEnumerable<Post> FilterByCategory(IEnumerable<Post> posts, string category) { if( !string.IsNullOrEmpty(category) ) { return posts.Where(p => p.Category.Contains(category)); }}... var posts = FilterByCategory(db.Posts, category); int count = posts.Count();...
The "db" was an EF object context object, but it could just as...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.