Browse Source

2008-09-28 Sebastien Pouliot <[email protected]>

	* Enumerable.cs: Add missing cast Average on IEnumerable<long?> to
	ensure the result is not truncated.
	[Found using Gendarme's ReviewCastOnIntegerDivisionRule]


svn path=/trunk/mcs/; revision=114330
Sebastien Pouliot 17 years ago
parent
commit
6fb0b958fa

+ 6 - 0
mcs/class/System.Core/System.Linq/ChangeLog

@@ -1,3 +1,9 @@
+2008-09-28  Sebastien Pouliot  <[email protected]>
+
+	* Enumerable.cs: Add missing cast Average on IEnumerable<long?> to
+	ensure the result is not truncated.
+	[Found using Gendarme's ReviewCastOnIntegerDivisionRule]
+
 2008-09-11  Jb Evain  <[email protected]>
 
 	* Enumerable.cs (Iterate*): use a bool empty instead of an int counter.

+ 1 - 1
mcs/class/System.Core/System.Linq/Enumerable.cs

@@ -225,7 +225,7 @@ namespace System.Linq
 		{
 			Check.Source (source);
 
-			return source.AverageNullable<long, long, double> ((a, b) => a + b, (a, b) => a / b);
+			return source.AverageNullable<long, long, double> ((a, b) => a + b, (a, b) => (double) a / b);
 		}
 
 		public static double? Average (this IEnumerable<double?> source)