Thursday, March 4, 2010

Lambda Expression in .net Part1

Lambda Expression new feature introduce in .net 3.0, is an anonymous method without a name and perform several operation in a few line of codes which is great.

In lambda expression we use the lambda operator => , Known as "goes to".

Here is an example of lambda operator

IList quieueList = list of BookingQueueInfo class;

Now we find all the BookingQueueInfo class which have property QueueEventType as 'ScheduleTimeChange' or as 'ReaccommodationMove'

Here is the code :

List bqiList =
new List(quieueList).FindAll(
q =>
q.QueueEventType == 'ScheduleTimeChange' || q.QueueEventType == 'ReaccommodationMove');

Please post if you have any query for Lambda Expression.

Cheers