22
33class Program
44{
5- static void Main ( )
6- {
7- // We can call our methods directly:
8- ExampleActions . Test ( ) ;
9- ExampleActions . Display ( 3 ) ;
10- ExampleActions < int > . DisplayArray ( new int [ ] { 20 , 30 , 40 } ) ;
5+ static void Main ( )
6+ {
7+ // We can call our methods directly:
8+ ExampleActions . Test ( ) ;
9+ ExampleActions . Display ( 3 ) ;
10+ ExampleActions < int > . DisplayArray (
11+ new int [ ] { 20 , 30 , 40 }
12+ ) ;
1113
12- // Or we can store them
13- // in variables and then call them:
14+ // Or we can store them
15+ // in variables and then call them:
1416
15- Action test_variable = ExampleActions . Test ;
16- test_variable ( ) ;
17+ Action test_variable = ExampleActions . Test ;
18+ test_variable ( ) ;
1719
18- Action < int > display_variable = ExampleActions . Display ;
19- display_variable ( 10 ) ;
20+ Action < int > display_variable = ExampleActions . Display ;
21+ display_variable ( 10 ) ;
2022
21- Action < int [ ] > display_array_variable = ExampleActions < int > . DisplayArray ;
22- display_array_variable ( new int [ ] { 10 , 20 , 30 } ) ;
23+ Action < int [ ] > display_array_variable =
24+ ExampleActions < int > . DisplayArray ;
25+ display_array_variable ( new int [ ] { 10 , 20 , 30 } ) ;
2326
24- // Passing an action as an argument:
25- CallingAction . Demo ( ExampleActions . Test ) ;
26- CallingAction . DemoT ( ExampleActions . Display ) ;
27+ // Passing an action as an argument:
28+ CallingAction . Demo ( ExampleActions . Test ) ;
29+ CallingAction . DemoT ( ExampleActions . Display ) ;
2730
28- // Done passing an action.
29- }
30- }
31+ // Done passing an action.
32+ }
33+ }
0 commit comments