Sunday, 9 March 2014

C# Events, Delegates and Lambdas

 

 

The Role of Events, Delegates and Event Handlers

image

 

 

image

 

 

image

 

 

 
The Role of Events

image

 

 

image

 

 

image

 

 

 

The Role of Delegates

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

 

The Role of Event Handlers

image

 

 

image

 

 

image

 

 

 

 

Demo: Events, Delegates and Event Handlers in Action

 

Events Raiser

image

 

 

 

Event Handler

 

image

 

 

 

Delegates

 

image

 

 

image

 

 

 

Creating Delegates, Events and EventArgs

image

 

 

 
Creating Delegates

image

 

 

image

 

 

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

 

Demo: Creating Customer Delegates

image

 

 

image

 

 

image

 

 

image

 

 

 

Demo:  Adding Multiple Delegates to an Invocation list

 

image

 

 

 

Demo:  Returning a value using a Delegates

image

 

 

image

 

 

image

 

 

image

 

Note:  In the case of Returning value in Multicast Delegates, only last value would be returned from the Delegates

 

 

Defining the Event

image

 

 

image

 

 

image

 

 

 

Demo:  Defining Events

 

image

 

 

 

Raising Events

image

 

 

image

 

 

 

Demo: Raising Events

image

 

 

image

 

 

image

 

 

 

Creating EventArgs

image

 

 

image

 

 

image

 

 

 

image

 

 

 

image

 

 

image

 

 

image

 

 

 

Demo:  Creating an EventArgs Class

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

 

Handling Events

image

 

 

 

Instantiating Delegates and Handling Events

image

 

 

image

 

 

image

 

 

 

Demo: Instantiating Delegates and Handling Events

 

image

 

 

image

 

image

 

 

 

Delegates Inference

image

 

 

image

 

 

image

 

 

 

Using Anonymous Methods

 

image

 

 

image

 

 

image

 

 

image

 

 

 

Lambdas, Action<T> and Func<T,TResult>

 

image

 

 

image

 

 

image

 

 

image

 

 

 

image

 

 

 

Demo:  Getting Started With Lambda

image

 

image

 

 

 

Demo:  Using Lambdas with Custom Delegates

image

 

 

image

 

 

 

Using Action<T>

 

image

 

 

 

image

 

 

 

Demo: Using Action<T>

image

 

 

image

 

 

 

Using Func<T,TResult>

image

 

 

Demo: Using Func<T,TResult>

image

 

 

image

 

 

 

Demo: Using Lambdas and Func<T,TResult> to Query Objects

 

image

 

 

image

 

 

image

 

 

 

Events and Delegates in Action

image

 

 

 

Communicating Between Components with Events and Delegates

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

image

 

 

 

Asynchronous Delegates – Bad

 

image

 

 

 

image

 

 

 

image

 

 

 

Asynchronous Delegates – Good

 

image

 

 

image

 

 

image

 

image

 

 

 

Using Back ground Worker Events

 

image

 

 

image

 

image

 

image

 

image

 

image

 

 

 

The Role of Delegates with Threads

 

image

 

 

image

 

 

image

 

 

image

 

 

 

Blogger Labels: Events,Delegates,Lambdas,Role,Event,Handlers,Demo,Action,Raiser,Handler,EventArgs,Customer,Multiple,Invocation,Note,Multicast,Class,Inference,Anonymous,Methods,Func,TResult,Lambda,Custom,Query,Objects,Components,Asynchronous,Back,Worker,Threads

No comments:

Post a Comment