We Recommend

Accelerated C# 2008 Accelerated C# 2008
This book is both a rapid tutorial and a permanent reference. You’ll quickly master C# syntax while learning how the CLR simplifies many programming tasks. You’ll also learn best practices that ensure your code will be efficient, reusable, and robust. Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way, right from the start?


Posted By

karelklic on 02/28/08


Tagged

lambda closures


Versions (?)


Anonymous methods in C#


Published in: C# 


Important note is http://blogs.msdn.com/abhinaba/archive/2005/10/18/482180.aspx


  1. static void AddUniqe(Item item, List<Item> list)
  2. {
  3. int offs = list.FindIndex(delegate(Item i) { return i.id == item.id; });
  4. if (offs >= 0)
  5. list[offs] = item;
  6. else
  7. list.Add(item);
  8. }

Report this snippet 

You need to login to post a comment.