2008-05-13 Jb Evain <jbevain@novell.com>
authorJb Evain <jbevain@gmail.com>
Tue, 13 May 2008 17:35:38 +0000 (17:35 -0000)
committerJb Evain <jbevain@gmail.com>
Tue, 13 May 2008 17:35:38 +0000 (17:35 -0000)
* EnumerableRowCollection.cs: delete methods
Select/Where/Cast that duplicate Linq to Objects
methods.
* EnumerableRowCollectionExtensions.cs
TypedTableBase.cs, TypedTableBaseExtensions.cs: directly
fallback to Linq to Objects.

svn path=/trunk/mcs/; revision=103103

mcs/class/System.Data.DataSetExtensions/System.Data/ChangeLog
mcs/class/System.Data.DataSetExtensions/System.Data/EnumerableRowCollection.cs
mcs/class/System.Data.DataSetExtensions/System.Data/EnumerableRowCollectionExtensions.cs
mcs/class/System.Data.DataSetExtensions/System.Data/TypedTableBase.cs
mcs/class/System.Data.DataSetExtensions/System.Data/TypedTableBaseExtensions.cs

index 05d7273bc741053661297499687e4ee08fd241f6..960580d1a89cbeea310425a35bf5c9c29f9d3d31 100644 (file)
@@ -1,3 +1,12 @@
+2008-05-13  Jb Evain  <jbevain@novell.com>
+
+       * EnumerableRowCollection.cs: delete methods
+       Select/Where/Cast that duplicate Linq to Objects
+       methods.
+       * EnumerableRowCollectionExtensions.cs
+       TypedTableBase.cs, TypedTableBaseExtensions.cs: directly
+       fallback to Linq to Objects.
+
 2008-05-13  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DataTableExtensions.cs, EnumerableRowCollection.cs,
index b712c5e1f52e3a93fc4f6b0e8b24bdf4bef8427f..7ed781957dac7f31d54cb72ad437369181f85fb1 100644 (file)
@@ -36,25 +36,6 @@ namespace System.Data
 {
        public abstract class EnumerableRowCollection : IEnumerable
        {
-               internal static IEnumerable<TResult> Cast<TResult> (IEnumerable source)
-               {
-                       foreach (object o in source)
-                               yield return (TResult) o;
-               }
-
-               internal static IEnumerable<S> Select<TRow, S> (IEnumerable<TRow> source, Func<TRow, S> selector)
-               {
-                       foreach (TRow row in source)
-                               yield return selector (row);
-               }
-
-               internal static IEnumerable<TRow> Where<TRow> (IEnumerable<TRow> source, Func<TRow, bool> predicate)
-               {
-                       foreach (TRow row in source)
-                               if (predicate (row))
-                                       yield return row;
-               }
-
                internal EnumerableRowCollection ()
                {
                }
index fa21bd393be4d361c6fb3ba1182971e16fadacdc..93cbe8b1954c2af57b3c7cd5df1ffcb417d375bd 100644 (file)
@@ -30,6 +30,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace System.Data
 {
@@ -37,7 +38,7 @@ namespace System.Data
        {
                public static EnumerableRowCollection<TResult> Cast<TResult> (this EnumerableRowCollection source)
                {
-                       return new EnumerableRowCollection<TResult> (EnumerableRowCollection.Cast<TResult> (source));
+                       return new EnumerableRowCollection<TResult> (Enumerable.Cast<TResult> (source));
                }
 
                public static OrderedEnumerableRowCollection<TRow> OrderBy<TRow, TKey> (this EnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector)
@@ -62,7 +63,7 @@ namespace System.Data
 
                public static EnumerableRowCollection<S> Select<TRow, S> (this EnumerableRowCollection<TRow> source, Func<TRow, S> selector)
                {
-                       return new EnumerableRowCollection<S> (EnumerableRowCollection.Select<TRow, S> (source, selector));
+                       return new EnumerableRowCollection<S> (Enumerable.Select<TRow, S> (source, selector));
                }
 
                [MonoTODO]
@@ -91,7 +92,7 @@ namespace System.Data
 
                public static EnumerableRowCollection<TRow> Where<TRow> (this EnumerableRowCollection<TRow> source, Func<TRow, bool> predicate)
                {
-                       return new EnumerableRowCollection<TRow> (EnumerableRowCollection.Where<TRow> (source, predicate));
+                       return new EnumerableRowCollection<TRow> (Enumerable.Where<TRow> (source, predicate));
                }
        }
 }
index daef62180c60bf5ad80696715fadc7cef1680996..33635b8490d9968c319f574773505b39cb0d9e08 100644 (file)
@@ -31,6 +31,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 using System.Runtime.Serialization;
 
 namespace System.Data
@@ -52,7 +53,7 @@ namespace System.Data
 
                public EnumerableRowCollection<TResult> Cast<TResult> ()
                {
-                       return new EnumerableRowCollection<TResult> (EnumerableRowCollection.Cast<TResult> (this));
+                       return new EnumerableRowCollection<TResult> (Enumerable.Cast<TResult> (this));
                }
 
                public IEnumerator<T> GetEnumerator ()
index 7502caefdb6b1fbdf62df08c257ffee0fe566979..3d476d3aabbe48812b583a5ce0760336f238eb00 100644 (file)
@@ -30,6 +30,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace System.Data
 {
@@ -68,13 +69,13 @@ namespace System.Data
                public static EnumerableRowCollection<S> Select<TRow, S> (this TypedTableBase<TRow> source, Func<TRow, S> selector)
                        where TRow : DataRow
                {
-                       return new EnumerableRowCollection<S> (EnumerableRowCollection.Select<TRow, S> (source, selector));
+                       return new EnumerableRowCollection<S> (Enumerable.Select<TRow, S> (source, selector));
                }
 
                public static EnumerableRowCollection<TRow> Where<TRow> (this TypedTableBase<TRow> source, Func<TRow, bool> predicate)
                        where TRow : DataRow
                {
-                       return new EnumerableRowCollection<TRow> (EnumerableRowCollection.Where<TRow> (source, predicate));
+                       return new EnumerableRowCollection<TRow> (Enumerable.Where<TRow> (source, predicate));
                }
        }
 }