Friday, January 15, 2010

Anonymous methods in C#

static void AddUniqe(Item item, List list)
{
int offs = list.FindIndex(delegate(Item i) { return i.id == item.id; });
if (offs >= 0)
list[offs] = item;
else
list.Add(item);
}