Skip to content

Instantly share code, notes, and snippets.

@SpikeXy
Last active October 2, 2017 01:33
Show Gist options
  • Save SpikeXy/3391691800ede41127d8297b72c1c84e to your computer and use it in GitHub Desktop.
Save SpikeXy/3391691800ede41127d8297b72c1c84e to your computer and use it in GitHub Desktop.
lambda demo , delegate的用法 #csharp
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