c# - Foreach loop to get an IEnumerable<T> -


when using foreach loop loop through collection of values types, necessary ienumerable<t> interface instead of non-generic ienumerable interface, prevent unwanted intermediate luggage instructions unbox appear in compiled code?

is necessary

it not necessary (necessary in context means required).

is idea: yes. saving unboxing in cases micro-optimisation (except in inner loops of cpu limited data processing). if know have collection of type of value type keeping information not waste time on box-unbox cycle , makes code easier work with.

the last point, given ide's intellisense capabilities, far valuable.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -