我有一个复杂的数据结构.简单版本如下所示:
public class Field { ListfieldRow; //I want to write a delete that iterates and deletes given the key //(Use Linq?) public void DeleteByKey(int key) { //Do Remove } } public class FieldRow { public int key; }
任何有关实施删除的帮助表示赞赏.
public class Field { ListfieldRow; public void DeleteByKey(int key) { fieldRow.RemoveAll(row => key == row.key); } } public class FieldRow { public int key; }