E.g. do I need to extract
bool xIsNull = x == null
from the loop where I check x == null
?
As I know if (a == tr
So with modern compilation and hardware optimizations I doubt there would be enough performance difference to make enough difference to worry about (if any).
Part of the point higher level languages like C# is to take these insignificant optimization details out of the hands of app devs and leave them to compiler devs who will do it much better and free up app devs to make their decisions off of readability/maintainablity and spend more time on high level algorithmic efficiency rather than the low level stuff. If you are having performance issues this is probably the least of your worries.
Bottom line I would recommend using whatever you feels makes your code most readable.