Last active
January 26, 2017 09:55
-
-
Save webgio/5fd886fa4df9fc00609c192e1513d112 to your computer and use it in GitHub Desktop.
High order function in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var add4To = AddNumber(4); | |
var newNumber = add4To(3); | |
Console.WriteLine(newNumber); | |
// prints 7 | |
} | |
public Func<int, int> AddNumber(int n) | |
{ | |
Func<int, int> t = (i) => i+n; | |
return t; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment