Last active
October 2, 2017 01:33
-
-
Save SpikeXy/3391691800ede41127d8297b72c1c84e to your computer and use it in GitHub Desktop.
lambda demo , delegate的用法 #csharp
This file contains 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
Action<int> printRoot = delegate(int number) | |
{ | |
Console.WriteLine(Math.Sqrt(number)); | |
}; | |
Action<IList<double>> printMean = delegate(IList<double> numbers) | |
{ | |
double total = 0; | |
foreach (double value in numbers) | |
{ | |
total += value; | |
} | |
Console.WriteLine(total / numbers.Count); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment