Just sharing some of my inconsequential lunch conversations with you... RSS  

Monday, November 26, 2007

More of C# new goodies

Here's another great link showing lambda operator.

One thing that still amazes me is how people react to the trend we are observing. Some of the people I show this link rather use:

int val = Fold(
delegate
(int a, int b) { return a * b; },
1, 3, 5, 7, 9
);

over:

int val = Fold((a, b) => a * b, 1, 3, 5, 7, 9);

Go figure...

Here's another sample from the same post (I've corrected the typo error as no integer squares to 5).


List list = new List {
1,
2,
3,
4,
5
};

List matches =
list.FindAll(
val => {
val = val * val;
return val != 9;
}
);



The resulting list should return {1, 2, 4, 5}.

No comments:

Development Catharsis :: Copyright 2006 Mário Romano