Skip to content

Instantly share code, notes, and snippets.

@PhiHuyHoang
Created September 12, 2018 21:22
Show Gist options
  • Save PhiHuyHoang/0eb3c4224ebef592d70ff61175c0de9f to your computer and use it in GitHub Desktop.
Save PhiHuyHoang/0eb3c4224ebef592d70ff61175c0de9f to your computer and use it in GitHub Desktop.
method constructor function example C#
static void ConsoleLog(string s)
{
Console.WriteLine($"[CONSOLE] {s}");
}
static void Main(string[] args)
{
/// section 1 ///
Logger log = new Logger();
log.AddLogMethod(ConsoleLog);
log.AddLogMethod(delegate (string s) { Console.WriteLine($"[ANON] {s}"); });
log.AddLogMethod(s => Console.WriteLine($"[LAMDA] {s}"));
log.LogThis("Hello, delegates"); Thread.Sleep(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment