//不是很明白List<T> list = new List<T>();//知道索引
list[i] = t;//知道T元素
可以通过FindIndex() 找到T的索引

解决方案 »

  1.   

    先remove元素,应该知道remove的下标,然后在insert到指定下标,应该就可以了吧
      

  2.   

    int index = list.FindIndex(new Predicate<string>(find));
    list.Insert(index, "新的值");bool find(string p)
    {
       return p.Equals("被替换的值");
    }
      

  3.   

    你所说的替换,我没理解。是list里的某人item的修改吗?替换应该也是修改吧。
    直接查找到这个item,然后修改它的值,不是可以吗?
      

  4.   


    +1 不过这样肯定效率不高不过反问LZ
    var Replace=new<T>LIST<T>[i]=Replace这样不行吗?感觉也是可以的吧。刚接触泛型不久~~ 不当之处见谅
      

  5.   

    例子,一个 1,2,3 的整数列表,把 2 替换成 4
    List<int> list = new List<int>() { 1, 2, 3 };
    int index = list.FindIndex(v1 => v1 == 2);
    list[index] = 4;
      

  6.   


    int index;
    while ((index = list.FindIndex(o => o == 要替换的元素)) >= 0)
    {
        list[index] = 新元素;
    }
      

  7.   

    今天碰到一样的事了,重建MODEL及相关方法吧,哈哈。