using System;
namespace MyCompiler
{
public class MyCustomOptions
{
public string Buffer;
}
public class MyCustom
{
public event EventHandler<MyCustomOptions> OnMessage;
public bool Message(string buffer)
{
if (OnMessage == null)
{
return false;
}
var options = new MyCustomOptions
{
Buffer = buffer
};
OnMessage(this, options);
return true;
}
}
public static class Program
{
public static void DisplayMessage(object sender, MyCustomOptions options)
{
Console.WriteLine(options.Buffer);
}
public static void Main(string[] args)
{
var custom = new MyCustom();
custom.OnMessage += DisplayMessage;
/*
custom.OnMessage += delegate(object sender, MyCustomOptions options)
{
Console.WriteLine(options.Buffer);
};
*/
/*
var custom = new MyCustom()
{
OnMessage += DisplayMessage
};
*/
Console.WriteLine("running...");
Console.WriteLine(custom.Message("hello world"));
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: