Action<> Delegesi

Action<> Delegesi,  Func<> gibi önceden tanımlı toplam 16 adet türü olan bir delege çeşidirdir. Farkı Tresult, yani geri değer döndürmemesidir.

 

class Program
    {
        static void Main(string[] args)
        {
            Action delegem = ()=>{ Console.WriteLine("merhaba Dünya");};
            Action<int,int> delegem2 = (x,y) => { Console.WriteLine(x*y); };
            Action<string> delegem3 = yaz;

            delegem();
            delegem2(3,5);
            delegem3("Erkan");
        }

        static void yaz(string mesaj)
        {
            Console.WriteLine("merhaba"+ mesaj);
        }
    }

Aslında List<T> türünden bir nesnenin Foreach iterasyonu için gereken parametre Action türündendir. aşağıda şekilde görüldüğü gibi.

 

 

 

Comments (2) -

q3Pyyv
13.3.2019 06:33:17 #

932729 250522Superb read, I lately passed this onto a colleague who has been performing a bit research on that. And the man truly bought me lunch because I came across it for him smile So allow me to rephrase that: Appreciate your lunch! 844182

ErkanYurek
27.5.2019 07:42:22 #

Thank You, enjoy it Smile

Add comment

The file '/Custom/Widgets/Calendar/widget.cshtml' does not exist.The file '/Custom/Widgets/Category list/widget.cshtml' does not exist.The file '/Custom/Widgets/Tag cloud/widget.cshtml' does not exist.The file '/Custom/Widgets/Page List/widget.cshtml' does not exist.The file '/Custom/Widgets/Month List/widget.cshtml' does not exist.