Browse by Tags

All Tags » CSharp » Delegate » VB (RSS)
This prior post demonstrated how to use delegates to associated code with a Tag in a WinForms control. This post shows how to accomplish the same thing using Lambda expressions to define the delegate. To try out this example, create a WinForms application...
Many of the Windows Forms controls have a Tag property that you can use to store data associated with the control. For example, TextBoxes have a Tag property so you could store additional information about each TextBox in the Tag. For TreeView controls...
Lambda expressions can be assigned to a delegate variable. The lambda expression is then executed when the delegate is called. [To begin with an overview of lambda expressions, start here .] In the following example, a lambda expression is assigned to...
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...
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...
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...
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...
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...