namespace EventsInCSharp
{
public class MyClass
public delegate void MyDelegate(string message);
public event MyDelegate MyEvent; // This is declaration of event
public void RaiseEvent(string message)
if (MyEvent != null)
MyEvent(message); // is here we are calling the event.....?
}
class Program
static void Main(string[] args)
MyClass myClass1 = new MyClass();
myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent);
Console.WriteLine("Please enter a message\n");
string msg = Console.ReadLine();
myClass1.RaiseEvent(msg); // what is happining here is event is calling here....?
Console.Read();
static void myClass1_MyEvent(string message)
Console.WriteLine("Your Message is: {0}", message);