Lambda Expressions Matt Van Horn Software Engineer Iverson Gaming Systems, Inc. @phpn00b
We thank the following companies for their gracious sponsorship Platinum Sponsors Gold Sponsor
What is a Lambda Expression ( => ) Why should I use Lambda Expressions What is a Delegate?
Syntax => Goes To (input parameters) => expression () => SomeMethod() (int x, string s) => s.Length > x (x, y) => x == y (input parameters) => {statement;}
Expressions + LINQ Func(T, TResult) is the most useful type of lambda for the average developer. Strong typed input and output.Where(obj =>obj.Name == Matt) Compiler can normally guess the type for T
Dynamic Lists Example (input parameters) => expression Single statement
statements! Ask your self is it method worthy code? If not make it anonymous function! Declare single use code inline! Reduce the chance of lookup whiplash! Many private methods can be a lambdize!
Func == awesome! Easy way to store a lambda that you use over and over again! Func findMatt = p=>p.Name == Matt; var matts = people.Where(findMatt);
Action == useful! people.ForEach(p => p.FirstName = );
l