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
Post a Comment