Geeks With Blogs

News Please visit me at my new blog!!

profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.



Programming and Learning from SD

Resharper is a fabulous tool for Visual Studio and is my HUD for what’s going on. It helps me see things I don’t always notice. For example, using an IEnumerable multiple times will have blue squiggles and saw “Possible multiple enumeration of IEnumerable”. The power and pitfalls of LINQ and deferred execution! To avoid the multiple enumeration I usually .ToList() the enumerable.

A colleague suggested using IReadOnlyList<T> which was added to .Net 4.5 in 2012 instead of IEnumerable<T> for parameters to methods. Then I no longer have to .ToList in the method, but the calling code will be in charge of doing so.

Posted on Tuesday, April 21, 2015 2:02 PM Performance , Pragmatic Programming , LINQ | Back to top


Comments on this post: IReadOnlyList as a method parameter

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Aligned | Powered by: GeeksWithBlogs.net