D
Daniel O'Connell [C# MVP]
Michael C said:Note that back to back in's is a big reason why I was pushing for isin in
another portion of the thread.
Yeah, when I saw how the comprehensions interact with other code, the 'in'
problem became clear.
Range = 1..5;
List = [Range];
Range = 6..10;
In that case its irrelevent.
Range = 6...10; creates a *new* object. You would just be replacing a
variables value, not the variable itself. IMHO, ranges should be
immutable
and joins should result in an entirely new range being generated.
That may be the case, but if we're assigning the range 1..5 to a variable,
and later assign the range 6..10 to the same variable... I suppose my
first
question is what happens to the original 1..5 range? I would expect that
(if it were an object) it would just be disposed of and the 6..10 range
replace it. The main question though was what does the variable List
contain after the instructions above? Is it [1..5], [6..10] or some other
value/values?
Tell me, what does
ArrayList list = new ArrayList();
string x="one";
list.Add(x);
x = "two";
what does Console.WriteLine(list[0]); write?
I see no reason to change existing behaviour here, a such the variable list
would be [1...5].