M
MuZZy
Hi,
Consider this:
ArrayList al = new ArrayList();
FillList(al);
/// NOW TWO SCENARIOS:
/// 1.
for (int i = 0 ; i < al.Count ; i++)
{..do whatever..}
/// 2.
int iCount = al.Count;
for (int i = 0 ; i < iCount ; i++)
{..do whatever..}
Yes, as you have already figured out my question is about preffered
scenario. I remember form the days of Delphi Pascal that you should
preffer second scenario as in the first property Count will be requested
on every loop.
Did anything change in C# and managed C++ or it's still proffered to use
scenario 2?
Thank you
MuZZy
Consider this:
ArrayList al = new ArrayList();
FillList(al);
/// NOW TWO SCENARIOS:
/// 1.
for (int i = 0 ; i < al.Count ; i++)
{..do whatever..}
/// 2.
int iCount = al.Count;
for (int i = 0 ; i < iCount ; i++)
{..do whatever..}
Yes, as you have already figured out my question is about preffered
scenario. I remember form the days of Delphi Pascal that you should
preffer second scenario as in the first property Count will be requested
on every loop.
Did anything change in C# and managed C++ or it's still proffered to use
scenario 2?
Thank you
MuZZy