ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 델리게이트 이벤트 소스 노가다
    Writer/WarmingUp Code 2008. 10. 13. 21:40
    반응형


    using System;

    class MainApp
    {
     public delegate void Mix(string s);// 델레게이트 선언

     public static void Coffee(string s)
     {
      Console.WriteLine("{0}",s);
     }


     public static void CoCoa(string s)
     {
      Console.WriteLine("{0}",s);
     }

     public static void Main()
     {
      Mix Tea = new Mix(Coffee);
      Tea("salt");

      Tea = new Mix(CoCoa);
      Tea("milk");
     }
    }



    using System;


    class delTest
    {

     public delegate void Mix(string s);

     public static void ccc(string s)
     {
      Console.WriteLine("{0}",s);
     }

     public static void ddd(string s)
     {
      Console.WriteLine("{0}",s);
     }

     
     public static void Main()
     {
      Mix TT = new Mix(ccc);
      TT("salt");
      TT = new Mix(ddd);
      TT("milk");
     }
    }

    using System;

    class TESTdel
    {
     public delegate void XXX(string s);

     public static void a1(string s)
     {
      Console.WriteLine(s);
     }

     public static void a2(string s)
     {
      Console.WriteLine(s);
     }

     

     public static void Main()
     {
      XXX xxx = new XXX(a1);
      xxx("salt");
      xxx = new XXX(a2);
      xxx("milk");
     }
    }




    using System;

    class TESTDEL
    {
     public static void Main()
     {
      DEL dele = new DEL(dels1);
      dele("소금");
      dele = new DEL(dels2);
      dele("밀크");
      

     
     }

     public static void dels2(string x)
     {
      Console.WriteLine(x);
     }


     public static void dels1(string z)
     {
      Console.WriteLine(z);
     }

     

     


    }

    public delegate void DEL(string x);



    using System;

    class deltest
    {
     delegate void del();

     public static void test()
     {
      Console.WriteLine("111");
     }
     public static void Main()
     {
      del d;
      d =test;
      d();
     }
    }





    using System;


    class deltest
    {

     delegate void del();

     static void test()
     {
      Console.WriteLine("zz");
     }

     static void Main()
     {
      del d;
      d = test;
      d();
     }

    }




    using System;

    class deltest
    {
     delegate void XXX();

     static void ttt()
     {
      Console.WriteLine("x1x");
     }

     
     static void Main()
     {
      XXX xxx = ttt;
      xxx();
     }
    }



    using System;


    class deltest
    {
     static void Main()
     {

      deltt tt = testdel;
      tt();
      
     }
     delegate void deltt();

     static void testdel()
     {
      Console.WriteLine("yy");
     }
    }



    using System;

    class deltest
    {
     static void objtest()
     {
      Console.WriteLine("test");
     }
     
     static void Main()
     {
      testdel deltest = objtest;
      deltest();
     }

     delegate void testdel();

    }


    using System;

    class MainApp
    {
     delegate void Mix(string xx);

     static void coffee(string xx)
     {
      Console.WriteLine("coffee {0}",xx);
     }

     

     static void Main()
     {
      Mix m = coffee;

      m("123");
     }
    }

    using System;

    class testApp

    {

     delegate void DEL(string y);

     static void Son5(string y)
     {
      Console.WriteLine("ccc {0}",y);
     }


     static void Main()
     {
      DEL deltest = Son5;
      deltest("yyy");
     }

    }



    using System;

    class testApp
    {
     delegate void deltest(int i);

     static void xy(int i)
     {
      Console.WriteLine("123 {0}",i);
     }


     static void Main()
     {
      deltest del = xy;

      del(777);
     }
    }


    using System;

    class deltest
    {
     delegate void delegay(int x);

     static void test(int x)
     {
      Console.WriteLine("zz{0}",x);
     }

     static void Main()
     {
      delegay girl = new delegay(test);
      girl(123);
      
     }
    }


    using System;

    class testDel
    {
     delegate void deltest(string x);

     static void xxx(string x)
     {
      Console.WriteLine("zzz {0}",x);
     }

     static void Main()
     {
      deltest del = xxx;
      del("스트링");
     }
    }


    using System;

    class test
    {
     delegate void testdele(string xxx);
     delegate void nulltest();
     
     static void Main()
     {

      nulltest nulldel = ndel;
      nulldel();
      
      testdele del= deleggg;

      del("string");

      testdele del2 = new testdele(xdel);
      del2("del2 string");


     }

     static void deleggg(string xxx)
     {
      Console.WriteLine("deleggg {0}",xxx);
     }

     static void xdel(string xxx)
     {
      Console.WriteLine("xdel {0}", xxx);
     }

     static void ndel()
     {
      Console.WriteLine("null del" );
     }
    }



    using System;

    class MainApp
    {

     delegate void Mix(string mix);
     static void Main()
     {
      Mix m = new Mix(coffee);
      m("wow");

      Mix s = new Mix(milk);
      s("owo");
     }

     static void coffee(string mix)
     {
      Console.WriteLine(mix);
     }

     static void milk(string mix)
     {
      Console.WriteLine(mix);
     }
    }

    using System;

    class testdel
    {
     delegate void ddel(string G);
     
     static void Main()
     {
      ddel del = new ddel(deleG);

      del("인자");
     }

     static void deleG(string adelG)
     {
      Console.WriteLine(adelG);
     }
    }





















    반응형

    'Writer > WarmingUp Code' 카테고리의 다른 글

    C# 객체생성과제  (0) 2008.10.20
    C# 과제  (0) 2008.10.17
    abstract interface  (0) 2008.10.15
    델리게이트 이벤트 소스 노가다 2  (0) 2008.10.14
    눈물의 소스 박스형 for와 if 사용 첨부 상철 상봉 오윤  (0) 2008.10.09
    소스 복습  (0) 2008.10.08
    객체지향 소스  (0) 2008.10.07
    성적출력  (0) 2008.10.07

    댓글

Designed by Tistory.