/ Published in: C#
Important note is http://blogs.msdn.com/abhinaba/archive/2005/10/18/482180.aspx
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
static void AddUniqe(Item item, List<Item> list) { int offs = list.FindIndex(delegate(Item i) { return i.id == item.id; }); if (offs >= 0) list[offs] = item; else list.Add(item); }