I have a collection, That needs to be ordered in the order it is created.
But then at any time The User can change the order (ie move the 4th item to the first postion)
Is there any Collections with pre-built methods?
or should I use a SortedList.
Add(key++, Object); //pseudo code
then to change item
SwapObject(int key, int SwapKey)
{
where key == value
tempvalue = key;
SwapKey = key;
key = tempvalue;
}
You can use a generic List<>
which has the Insert
method, so you can insert an object in a given position any time.