using System; public class ClassA {} public delegate int IntDelegate (int x); public delegate T[] TDelegate (); public class Gen { public int intFunction (int x) { return x + 1; } public IntDelegate getIntDelegate () { return intFunction; } public virtual int virtIntFunction (int x) { return x + 2; } public IntDelegate getVirtIntDelegate () { return virtIntFunction; } public T[] tFunction () { return new T[3]; } public TDelegate getTDelegate () { return tFunction; } public static T[] staticTFunction () { return new T[3]; } public TDelegate getStaticTDelegate () { return staticTFunction; } } public class main { public static int Main () { Gen ga = new Gen (); IntDelegate id = ga.getIntDelegate (); TDelegate tda = ga.getTDelegate (); IntDelegate vid = ga.getVirtIntDelegate (); TDelegate stda = ga.getStaticTDelegate (); if (id (123) != 124) return 1; if (tda ().GetType () != typeof (ClassA[])) return 1; if (vid (123) != 125) return 1; if (stda ().GetType () != typeof (ClassA[])) return 1; tda = (TDelegate)Delegate.CreateDelegate (typeof (TDelegate), typeof (Gen).GetMethod ("staticTFunction")); if (tda ().GetType () != typeof (ClassA[])) return 1; return 0; } }