public delegate void MyEventHandler(object source, MyEventArgs e);
public class MyEventArgs : EventArgs
private string EventInfo;
public MyEventArgs(string Text) {
public string GetInfo() {
public event MyEventHandler OnMaximum;
private int Maximum = 10;
OnMaximum(this, new MyEventArgs("You've entered " +
", but the maximum is " +
static void MaximumReached(object source, MyEventArgs e) {
Console.WriteLine(e.GetInfo());
public static void Main(string[] args) {
MyClass MyObject = new MyClass();
MyObject.OnMaximum += new MyEventHandler(MaximumReached);
for(int x = 0; x <= 15; x++) {