I have:
Rectangle[] rects = new Rectangle[10000];
I want to initialize the values of rects as follows:
Option A:
========
for (int i=0; i<rects.Length; i++)
{
rects[i].X = 0;
rects[i].Y = 0;
rects[i].Size.Width = 100;
rects[i].Size.Height = 20;
}
(By the way, rects[i].Size.Width = 100 above generates a compiler
error. I haven't figured out why.)
What is the impact on memory or performance, if any, if I use the
following instead:
Option B:
========
for (int i=0; i<rects.Length; i++)
rects[i]=new Rectangle(new Point(0,0), new Size(100,20));
Option C:
========
for (int i=0; i<rects.Length; i++)
{
rects[i].Location = new Point(0,0);
rects[i].Size = new Size(100,20);
}
Thank you for your help.