Articles → CSHARP → Action Delegate In C#

Action Delegate In C#






Purpose





Example


using System; 
 
public class Program
{
        static void Main(string[] args)
        {      
                Action<string> printActDel = ActionDelegateDemo;
                printActDel("World");
 
                Console.ReadLine();
        }
 
        public static void ActionDelegateDemo(string name)
        {
                Console.WriteLine(String.Format("Hello {0}", name));
        }
 
}



Output


Picture showing the output of action delegate in c#
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, April 8, 2022

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250