Do I have to optimize my FOR-loops like below or the compiler will do that for me?
//this is slow, right?
for (int i = 0; i < menuItem.DropDownItems.Count; i++)
{
...
}
//this should be much faster right?
for (int i = 0, count = menuItem.DropDownItems.Count; i < count; i++)
{
...
}
PS. I bet this was already posted but I haven't found anything, sorry for a possible dup.
PPS. Sorry, I code a lot of JavaScript - where we have to think these kind of optimizations... May seem ridiculous in .net-world.