Predicate<INT> match question

Posted by Petr on Stack Overflow See other posts from Stack Overflow or by Petr
Published on 2010-04-30T09:05:40Z Indexed on 2010/04/30 9:07 UTC
Read the original article Hit count: 291

Filed under:
|
|
|

Hi, I do not understand how following code works. Specifically, I do not understand using of "return i<3". I would expect return i IF its < than 3. I always though that return just returns value. I could not even find what syntax is it. Second question, it seems to me like using anonymous method (delegate(int i)) but could be possible to write it with normal delegate pointing to method elsewere? Thanks

            List<int> listOfInts = new List<int> { 1, 2, 3, 4, 5 };
            List<int> result = listOfInts.FindAll(delegate(int i) { return i < 3; });

© Stack Overflow or respective owner

Related posts about c#

Related posts about anonymous-methods