Ignore performance, which is unlikely to become a bottleneck, it should not be what you think about until you have proven that it meets the relevant criteria.
I would still care about readability, and from this point of view, I believe that the second approach will be much better and, of course, will use it.
EDIT: From an optimization point of view, it seems that the C # compiler is not optimizing it:
However, this is not IL, which will matter, of course, this is what the JIT compiler does. Now even the difference in the size of the IL can mean the difference between the investment and not ...
source share