D
Dave Sexton
Hi Adam,
Lol - thanks for clearing that up
I guess Fabio assumed that I was speaking about different code in my
original response to Mark Rae. When I wrote, "simply to save 2 lines of
code", I was referring to the two lines of code in my example. I think the
problem stemmed from the fact that Mark didn't quote Jon completely and then
I addressed his point in terms of the OPs question. This is why I think
statements should be addressed in complete contexts, not arbitrary excerpts.
Thanks again for pointing that out - it was really throwing me for a loop.
--
Dave Sexton
Lol - thanks for clearing that up

I guess Fabio assumed that I was speaking about different code in my
original response to Mark Rae. When I wrote, "simply to save 2 lines of
code", I was referring to the two lines of code in my example. I think the
problem stemmed from the fact that Mark didn't quote Jon completely and then
I addressed his point in terms of the OPs question. This is why I think
statements should be addressed in complete contexts, not arbitrary excerpts.
Thanks again for pointing that out - it was really throwing me for a loop.
--
Dave Sexton
Adam Clauss said:Dave Sexton said:Hi Fabio,
Well, I've explained it three times already so I really don't know what
other evidence there is to submit. Yes, the two solutions both have the
same outcome, but how they get there is quite different.
<snip>
Having read this thread - I'm going to throw out that I think you guys are
talking about two different sets of code
I *think* Fabio is referring to the following examples given by Jon
Shemitz:
return new List<Schema>(schemas.Values).ToArray();
vs
List<Schema> Values = new List<Schema>(schemas.Values);
return Values.ToArray();
To which, I would agree they probably generate the same IL.
Dave, I think you are referring to what you originally posted:
Schema[] array = new Schema[schemas.Count];
schemas.Values.CopyTo(array, 0);
return array;
vs
What Jon posted.
To which I also agree - the first is more effecient as it does not have to
iterate across the collection twice.