+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,
{
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 ()
{
}
using System;
using System.Collections.Generic;
+using System.Linq;
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)
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]
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));
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Runtime.Serialization;
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 ()
using System;
using System.Collections.Generic;
+using System.Linq;
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));
}
}
}