Skip to content

Instantly share code, notes, and snippets.

@dance2die
Created March 31, 2018 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/3a50fa4e91997ac7518f2a55f0332992 to your computer and use it in GitHub Desktop.
Save dance2die/3a50fa4e91997ac7518f2a55f0332992 to your computer and use it in GitHub Desktop.
private static void AverageDemo(List<Order> orders)
{
var averageQuantity = orders.Average(order => order.Quantity);
var totalQuantities = orders.Sum(order => order.Quantity);
var count = orders.Count();
WriteLine($"Average Quantity: {totalQuantities} / {count} = {averageQuantity}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment