Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

Archive for October, 2009

October 11, 2009

Lambda Expressions: Func Delegates

Filed under: C#,Lambda Expressions,VB.NET @ 6:49 pm

A Func delegate encapsulates a method that returns a value. It takes up to four parameters (and this number is increased in .NET 4.0) plus the return value. [To begin with an overview of lambda expressions, start here.] The following signature is a Func delegate that takes two integer parameters and returns a string. In […]

Lambda Expressions: Action Delegates

Filed under: C#,Lambda Expressions,VB.NET @ 6:04 pm

Just as the name implies, an action delegate encapsulates a method that performs an action and has no return value. It takes up to four parameters (and this number is increased in .NET 4.0). [To begin with an overview of lambda expressions, start here.] The ForEach method of the List<T> is an example of an […]

Lambda Expressions: Predicate Delegates

Filed under: C#,Lambda Expressions,VB.NET @ 5:45 pm

According to Wikipedia, a predicate is “a function which returns a Boolean value”. [To begin with an overview of lambda expressions, start here.] A predicate delegate encapsulates a method that evaluates to True or False. It takes a single parameter. The Array class Find method is an example of a predicate delegate. It takes an […]

Lambda Expressions: Syntax

Filed under: C#,Lambda Expressions,VB.NET @ 4:02 pm

This post covers the syntax for lambda expressions. It uses the customer list defined in this prior post. [To begin with an overview of lambda expressions, start here.] The first example below uses the FirstOrDefault extension method on the Enumerable object to find the first customer that matches the defined expression. The FirstOrDefault method takes […]

Delegates

Filed under: C#,Lambda Expressions,VB.NET @ 3:29 pm

A delegate is an object that holds a reference to a method with a particular parameter list and return type. It is basically like an object-oriented, type-safe function pointer. Delegates basically make it possible to treat methods as entities. You can then assign a delegate to a variable or pass it as a parameter. The […]

Lambda Expressions: Finding an Item in a Generic List

Filed under: C#,Lambda Expressions,LINQ,VB.NET @ 2:52 pm

In this prior post, I detailed how to build lists of things using a generic List<T>. Once you have a list, you may need to find items in the list. There are several ways to accomplish this, but using lambda expressions is the most concise. [To begin with an overview of lambda expressions, start here.] […]

Lambda Expressions: An Introduction

Filed under: C#,Lambda Expressions,VB.NET @ 2:11 pm

My presentation at our local Code Camp was fun. I covered a lot of material and had a GREAT audience. Several people have asked for the slide information in my blog. So this is the start of several posts on lambda expressions. In addition, I wrote an article on lambda expressions that should appear in […]

October 2, 2009

Silicon Valley Code Camp

Filed under: User Group @ 6:30 pm

The Silicon Valley Code Camp is coming up tomorrow (October 3, 2009). I am looking forward to attending! My presentation is on Lambda expressions in C# and VB. You can find the code here. If you are interested in finding out more about this FREE code camp, check it out here. Enjoy!

« Previous Page

© 2023 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs