Assuming the map is a Dictionary<TKey, TValue>, you can use LINQ to calculate the average of all the values:
main.cs140 chars7 lines
This code uses the Average extension method provided by LINQ to calculate the average of the values in the Dictionary. Note that Values is a property of the Dictionary that returns a collection of all the values. If the Dictionary contains a different type of value, you may need to cast the values to double or another appropriate type before calculating the average.
gistlibby LogSnag