Events invoking

Before

public class Person
{
   public event EventHandler Updated;

   public void Update()
   {
      if (Updated != null)
      {
           Updated(this, EventArgs.Empty);
      }
   }
}

After

public class Person
{
   public event EventHandler Updated;

   public void Update()
   {
       Updated.Execute(this, EventArgs.Empty);
   }
}

 


 Before

public class Person
{
   public event EventHandler<CustomEventArgs> Updated;

   public void Update()
   {
      if (Updated != null)
      {
           Updated(this, new CustomEventArgs(...));
      }
   }
}

After

public class Person
{
   public event EventHandler<CustomEventArgs> Updated;

   public void Update()
   {
      Updated.Execute(this, new CustomEventArgs(...));
   }
}

Last edited Jun 14, 2011 at 7:41 PM by Sergun, version 3

Comments

No comments yet.