SortedList

1..sortedList集合中的元素删除后,并不会更新其索引。(不在内存中更新其后续元素)。

 2..

  private SortedList lists=new SortedList();

private AssamblyInfo GetAssemblyByIndex(int index)
  {
   return (AssamblyInfo)lists[index];
  }

返回的是对象的引用。

  private AssamblyInfo GetAssemblyByName(string name)
  {
   foreach (AssamblyInfo item in lists.Values)
   {
    if (item.Name == name)
     return item;
   }
   return null;
  }

修改

AssamblyInfo infoPrv = GetAssemblyByIndex(info.Index);
  infoPrv.Index -= 1;

在此处修改其值,就是修改该元素初始化时内存的值。

原文地址:https://www.cnblogs.com/363546828/p/2244373.html