> Is there a faster way to add the array elements to a list then looping
> through
[quoted text clipped - 7 lines]
>
> }
In this particular case, yes:
List<double> listwant = new List<double>(toadd);
Whether it applies to your real life situation is a different matter,
however.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Ben Voigt [C++ MVP] - 30 Aug 2007 20:46 GMT
>> Is there a faster way to add the array elements to a list then looping
>> through
[quoted text clipped - 11 lines]
>
> List<double> listwant = new List<double>(toadd);
or List<T>.AddRange(IEnumerable<T>) can accept an array as well, in case the
list isn't empty to begin with.
> Whether it applies to your real life situation is a different matter,
> however.
Bob,
This kind of questions depends mostly for what you mean with "fast".
If it is about looping, then it is mostly that in a method the looping is
replaced behind the scene and the processing time will be almost the same.
However, often it can with less row to write, which does not mean that it
goes faster.
Remember that looping in a good written loop is extremely fast, at that
point you will seldom find any processing time that is recognizable by the
user.
However if it is about coding, than you sometimes can find some less rows,
although with a foreach loop we are talking as well mostly about 2 or 3
rows.
Cor
> Is there a faster way to add the array elements to a list then looping
> through
[quoted text clipped - 10 lines]
> Thanks,
> Bob
Bob - 31 Aug 2007 04:28 GMT
On Aug 28, 10:43 pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
> Bob,
>
[quoted text clipped - 29 lines]
> > Thanks,
> > Bob
Thanks so much