Browse Source

2010-03-30 Jb Evain <[email protected]>

	* Queryable.cs: implement Zip for net_4_0.


svn path=/trunk/mcs/; revision=154460
Jb Evain 15 years ago
parent
commit
e800d606de

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

@@ -1,3 +1,7 @@
+2010-03-30  Jb Evain  <[email protected]>
+
+	* Queryable.cs: implement Zip for net_4_0.
+
 2010-03-24  Jb Evain  <[email protected]>
 
 	* SortSequenceContext.cs: Fix OrderByDescending stability.

+ 18 - 0
mcs/class/System.Core/System.Linq/Queryable.cs

@@ -1604,5 +1604,23 @@ namespace System.Linq {
 
 		#endregion
 
+#if NET_4_0
+		#region Zip
+
+		public static IQueryable<TResult> Zip<TFirst, TSecond, TResult> (this IQueryable<TFirst> source1, IEnumerable<TSecond> source2, Expression<Func<TFirst, TSecond, TResult>> resultSelector)
+		{
+			Check.Source1AndSource2 (source1, source2);
+			if (resultSelector == null)
+				throw new ArgumentNullException ("resultSelector");
+
+			return source1.Provider.CreateQuery<TResult> (
+				StaticCall (
+					MakeGeneric (MethodBase.GetCurrentMethod (), typeof (TFirst), typeof (TSecond), typeof (TResult)),
+					source1.Expression,
+					Expression.Quote (resultSelector)));
+		}
+
+		#endregion
+#endif
 	}
 }