Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
We use foreach at home, they are more convenient, but we don’t observe any brakes. If the profiler says that it slows down, replace it with for. Do not bother with optimization ahead of time, write as convenient. Brakes will appear, look at the profiler, draw conclusions.
in fact, for will be faster. mono will recompile foreach and while into IEnumerable + switching methods
mono seems to compile them in while yes. but not the fact that still. for example, if you use a compiler from the studio, then there is no such problem and foreach fly for generics of the List<> type. you need to research ..
here is sort of relevant research:
www.somasim.com/blog/2015/04/csharp-memory-and-per...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question