I have a list on my WinForms where users can move items up and down, and this list also matches the list I have, and I was wondering what would be the most efficient way to keep synchronized.
For example, to move an item down, I:
int i = this.recoveryList.SelectedIndex;
object o = this.recoveryList.SelectedItem;
if (i < recoveryList.Items.Count - 1)
{
this.recoveryList.Items.RemoveAt(i);
this.recoveryList.Items.Insert(i + 1, o);
this.recoveryList.SelectedIndex = i + 1;
}
And I have:
public List<RouteList> Recovery = new List<RouteList>();
Which I would like to update in the list.
Should I just clear the restore and update with the current list data, or is there a better way to update them when moving up and down?
I basically ask because the types from list to list are different.
source
share