I have a collection of <int>s.
1
2
3
When I remove, for example, the 2, The collection becomes 1,3. However, when I go to add another item the list becomes
1
3
3
Because the sequence is based off the count of items in collection
Is there an easy way to resequence. The example above where I’m showing 1,3 should be resequence to 1,2 and then the next new item will be a 3.
You could rewrite your list every time you remove an object using
Enumerable.Range, so the code to you would be something like this:so the add will be something like this
Note: in the add element you should remove the +1 if the list is zeroBased.