From 44e0778ae2f76d00d537bd725ada12a5ae5b1b95 Mon Sep 17 00:00:00 2001 From: jbevain Date: Fri, 3 Apr 2009 10:48:28 +0000 Subject: [PATCH] 2009-04-03 Jb Evain * Enumerable.cs (Cast): fix for when casted enumerator is already of the appropriate type. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@130961 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- class/System.Core/System.Linq/ChangeLog | 5 +++++ class/System.Core/System.Linq/Enumerable.cs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/class/System.Core/System.Linq/ChangeLog b/class/System.Core/System.Linq/ChangeLog index c45fb28df0..7eb8faa5ce 100644 --- a/class/System.Core/System.Linq/ChangeLog +++ b/class/System.Core/System.Linq/ChangeLog @@ -1,3 +1,8 @@ +2009-04-03 Jb Evain + + * Enumerable.cs (Cast): fix for when casted enumerator is already + of the appropriate type. + 2009-03-28 Jb Evain * Enumerable.cs: fix Intersect. diff --git a/class/System.Core/System.Linq/Enumerable.cs b/class/System.Core/System.Linq/Enumerable.cs index d2c98d0a19..0459dfc4d7 100644 --- a/class/System.Core/System.Linq/Enumerable.cs +++ b/class/System.Core/System.Linq/Enumerable.cs @@ -335,6 +335,10 @@ namespace System.Linq { Check.Source (source); + var actual = source as IEnumerable; + if (actual != null) + return actual; + return CreateCastIterator (source); } -- 2.11.4.GIT