Quote:
In some article i read that arrays are faster than generic list, but i got different results (or i was wrong).
You are wrong!
The problem is that your code don't try to access list or array.
Your code is optimized by compiler:
stopWatch.Start();
int Tmp= mojaLista.Count;
for (int i = 0; i < Tmp; i++)
{
i = i + 1;
}
and can be:
stopWatch.Start();
int Tmp= mojaLista.Count;
for (int i = 0; i < Tmp; i+=2)
{
}
Nothing can beat an array on read/write.
A list is faster than array when you need to resize (add or remove elements).