A question regarding IEnumerable and in general the ToList/ToDictonary/ICollection interfaces.

Hello,

I have a class like this: http://ift.tt/1P2nVKD

I was curious how long the collections took, so I did a benchmark of 25000 iterations. To my surprise, the IEnumerable .ToList version performed slightly faster.

I was under the assumption that things like .ToList used a decent bit of resources extra, as well as interface usage like in the example link given above?

Any links with related information to the collections .ToX variations and collection interfaces speed and such would be neat to understand better, as a project I want to do soon involves 100's of thousands of objects being created on a regular basis to a collection of sorts. Thanks!

by JacobKemple via /r/csharp

Leave a Reply