Consider the simple list of int's:
var ints = new List<int>
{
1, 2, 3
};
Will it always be ordered in the same order (1, 2, 3) if I loop thru it? Even if I pass it as a argument to a function or if I pass it as a list for a thread to process?
Are Arrays different? What about IEnumerable?
What if I for instance:
ints.RemoveAt(1);
ints.Add(4);
Will it always be 1,3,4
?
What about if I edited an element? These are only integers, but if they were complex objects, person, for instance and I grabbed person Bob
(could be at any index) and for instance added his whole biography.
Would it change the order of the list?
I could use OrderBy
, but I am merely interested to know if the order of a list is the same.