facebook google twitter tumblr instagram linkedin
  • Home
  • Travel
  • Life Style
    • Category
    • Category
    • Category
  • About
  • Contact
  • Download

c-sharp codes

This is completely for C# .Net programming blog. It covers all or Microsoft Visual Studio .Net 1.1, 2.0. 3.0 and 3.5.

Very simple user event in C#. Codes are:

using System;
using System.Collections.Generic;
using System.Text;

namespace Events
{
class Program
{
static void Main(string[] args)
{
EventTestClass obj = new EventTestClass();
obj.RaiseEvent1 += new EventTestClass.TestEventDelegate(obj_RaiseEvent);
obj.Run("call 1", "arg");
obj.Run("call 2", "arg");
obj.Run("call 3", "arg");
Console.ReadLine();

}

static void obj_RaiseEvent(object sender, object Args)
{
Console.WriteLine("Done. "+sender.ToString()+"...............\n");
}

}
class EventTestClass
{
public delegate void TestEventDelegate(object sender, object Args);
public event TestEventDelegate RaiseEvent1;
public EventTestClass()
{

}

public void Run(object sender, object Args)
{
Console.WriteLine("Run called");
RaiseEvent1(sender, Args);
}

}

}
7:16 AM No comments

About me

About Me


Aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit. Duis sed odio sit amet nibh vulputate.

Follow Us

Labels

C# User Even

recent posts

Blog Archive

  • ▼  2007 (2)
    • ▼  October (2)
      • Get-Set property in C#
      • User Event in C#

About Me

My photo
Suman Biswas
Software professional, long drive travel is my passion.
View my complete profile
FOLLOW ME @INSTAGRAM

Created with by ThemeXpose