Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Action Delegate in C#
Action delegate does not return a value and can be used with a method that has a void return type.
Declare Action Delegate.
Action<int> del = Display;
Here is our method −
public static void Display(int val) {
Console.WriteLine(val);
}
Now call the method with a value.
Example
using System;
public class Demo {
public static void Main() {
Action<int> del = Display;
del(2);
}
public static void Display(int val) {
Console.WriteLine(val);
}
}
Output
2
Advertisements
