Delegates

strict warning: Only variables should be passed by reference in /homepages/34/d93266176/htdocs/el-badawy/modules/book/book.module on line 559.
  • A Delegate is a reference type
  • Delegates are similar to function pointers in C or C++
  • Delegates are type safe and secure
  • Events are based on delegates
class Program {
    public delegate bool Test( int x );
    public static bool f( int x ) { return true; }
    public static void Main() {
        Test test1 = f;
    }
}