Sfoglia il codice sorgente

2009-04-03 Jb Evain <[email protected]>

	* Enumerable.cs (Cast): fix for when casted enumerator is already
	of the appropriate type.


svn path=/trunk/mcs/; revision=130961
Jb Evain 16 anni fa
parent
commit
db2a0eb2fb

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

@@ -1,3 +1,8 @@
+2009-04-03  Jb Evain  <[email protected]>
+
+	* Enumerable.cs (Cast): fix for when casted enumerator is already
+	of the appropriate type.
+
 2009-03-28  Jb Evain  <[email protected]>
 
 	* Enumerable.cs: fix Intersect.

+ 4 - 0
mcs/class/System.Core/System.Linq/Enumerable.cs

@@ -335,6 +335,10 @@ namespace System.Linq
 		{
 			Check.Source (source);
 
+			var actual = source as IEnumerable<TResult>;
+			if (actual != null)
+				return actual;
+
 			return CreateCastIterator<TResult> (source);
 		}