In today's world, you shall not blame on programmers, this is the UX/UI job. Programmers simply implement what they have been asked to do.
yxhu
Posts
-
Dear Programmers, Why do you hate me? -
Performance GeniusLol... that was a typo. Thanks Adrian0. :thumbsup:
-
Performance GeniusAdrian0, unfortunately, your solution was invalid. As ++i will be calculated(increased) before accessing the element of data collection. container will never have data[0], plus you will receive an out of index exception at the final loop of this for expression. Say data collection has 4 elements. Each iteration looks like: Loop 1, i initialised = 0: container.Add(data[1]).Items Loop 2, i initialised = 1: container.Add(data[2]).Items Loop 3, i initialised = 2: container.Add(data[3]).Items Loop 3, i initialised = 3: container.Add(data[4]).Items <<< Exception here When i++ or ++i is within an expression, ++i has the highest priority to get executed bofere the reset of the expression. In contrast, i++ is get executed after the whole expression has been executed. container.Add(data[i++].Items) //Get the ith element of data collection, append to container and then increase i by 1 container.Add(data[++i].Items) //Increase i by 1, then get the 1th element of data collection to append to the container.
-
Performance Geniusimproved version of above can be like: for ( int i = 0; i < data.Count; container.Add(data[i++].Items)