We are considering about using a BCL collection for storing a set of elements. The collection will be manipulated exclusively with IList<T> as the order matters. The order is extremely important as collection’s elements represent programs which run on an industrial system. So an unexpected change in the order could have life threatening consequence. As such system are supposed to live for 15~20 years (sometime even more), long term software backward compatibility is really important.
As .Net 4.5 was an in place upgrade (and not side-by-side) which introduce some breaking change in .Net 4 application, I’m now wondering if Ms BCL team completely guarantee the ordering behavior of BCL collections over time?
I mean that no upgrade will never modify something about how collection handle their elements which could result in a different order?
For example:
I use a collection to handle some elements, I serialize it with .Net 4, then de-serialize 5 years later with .Net 6. Is it 100% sure (unless bug of course) the de-serialize process will give me the collection with exactly the same order?
If yes, we can use a good old System.Collections.Generic.Collection<T>.
If no, we will have to use a collection which give us the complete control on order or implement our own collection (worst case scenario).
According to the MSDN documentation, it seem clear the order is constant. But I have a doubt as this information is indicated in IList and not clearly stated in IList implementation like Collection. And some collection like Dictionnary clearly indicated the order of elements can change, but other collection does not specify if order behavior could change or not.
Please note I'm looking for an official answer from Ms BCL team here.