The repository contains a collection of different programming snippets to different programming languages from own developments as well as other projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
programming-examples/c-sharp/Functions/C# Program to Create Anonym...

29 lines
597 B

/*
* C# Program to Create Anonymous Method
*/
using System;
delegate void Print(string s);
class TestClass
{
static void Main()
{
Print obj = delegate(string j)
{
System.Console.WriteLine(j);
};
obj("Delegate Using the Anonymous Method");
obj = new Print(TestClass.named);
obj("Delegate Using the Named Method");
Console.Read();
}
static void named(string k)
{
System.Console.WriteLine(k);
}
}
/*
Delegate Using the Anonymous Method
Delegate Using the Named Method