Event handling in C#

I have always had problem with understanding the implementation of event handling. So, this post is going to serve me as a step-by-step guide to handle events in C#.

There are basically two steps in involved in this process. First, to implement events and second, to handle them.

A. Implement events

Step 1 : Create an EventArgs class

The first step is to create an EventArgs subclass as follows:

public class StartEventArgs: EventArgs

{

        // Provide one or more constructors, as well as fields and
// accessors for the arguments.

Continue reading

Advertisements

ABCs of Design Patterns

  • What is a design pattern?
    • A design pattern is a proven solution to a common problem faced by the software developers. They became popular with the rise of OOAD. They are designed to help developers deliver high quality, easily maintained products in lesser time and at a lower cost.
  • How is it classified?
    • They are classified on the basis of the underlying problem they address.
      • Behavioural Design Patterns –  characterize the manner of class and object interaction and how responsibilities are distributed among them.
      • Creational Design Patterns – address the object creation process. Creational design patterns encapsulate knowledge about how, when, and by whom an instance is created.
      • Structural Design Patterns –  address the composition of classes and objects.