using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace ConsoleApplication1 { public cla
Everything leppie said - plus:
int index = mylist.FindIndex(p => p.id == 1); if(index<0) { mylist.Add(car3); } else { mylist[index] = car3; }
This just uses the existing FindIndex to locate a car with id 1, then replace or add it. No LINQ; no SQL - just a lambda and List.
List