c++: Fix handling of the `final` contextual keyword
[geany-mirror.git] / tests / ctags / keyword_delegate.cs
blobfe5a57d5475cdea71916400788dfb4337f6ed4ed
1 // keyword_delegate.cs
2 // delegate declaration
3 delegate void MyDelegate(int i);
5 class Program
7 public static void Main()
9 TakesADelegate(new MyDelegate(DelegateFunction));
12 public static void TakesADelegate(MyDelegate SomeFunction)
14 SomeFunction(21);
17 public static void DelegateFunction(int i)
19 System.Console.WriteLine("Called by delegate with number: {0}.", i);
23 // keyword_delegate2.cs
24 // Calling both static and instance methods from delegates
25 using System;
27 // delegate declaration
28 delegate void MyDelegate();
30 public class MyClass
32 public void InstanceMethod()
34 Console.WriteLine("A message from the instance method.");
37 static public void StaticMethod()
39 Console.WriteLine("A message from the static method.");
43 public class MainClass
45 static public void Main()
47 MyClass p = new MyClass();
49 // Map the delegate to the instance method:
50 MyDelegate d = new MyDelegate(p.InstanceMethod);
51 d();
53 // Map to the static method:
54 d = new MyDelegate(MyClass.StaticMethod);
55 d();