P
puzzlecracker
Can you make an Anonymous methods receive and return values?
Otherwise, they appear useful for void methods?
Thanks
Otherwise, they appear useful for void methods?
Thanks
Can you make an Anonymous methods receive and return values?
Otherwise, they appear useful for void methods?
Thanks
Yes:
Predicate<int> isEven = delegate(int i)
{ return i % 2 == 0; }; // C# 2.0
Predicate<int> isEven = i => i % 2 == 0; // C#3.0
Console.WriteLine(isEven(4));
Console.WriteLine(isEven(5));
Marc
What's Predicate<int>, not familiar with Predicate class.
Thanks