You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
975 B
42 lines
975 B
#if NET20
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace System.Linq
|
|
{
|
|
|
|
/// <summary></summary>
|
|
public static class Enumerable
|
|
{
|
|
|
|
/// <summary></summary>
|
|
public static List<T> ToList<T>(this IEnumerable<T> items)
|
|
{
|
|
var list = new List<T>();
|
|
foreach (var item in list) list.Add(item);
|
|
return list;
|
|
}
|
|
|
|
/// <summary></summary>
|
|
public static T[] ToArray<T>(this IEnumerable<T> items)
|
|
{
|
|
return ToList(items).ToArray();
|
|
}
|
|
|
|
/// <summary></summary>
|
|
public static List<TResult> Select<TSource, TResult>(this IEnumerable<TSource> items, Func<TSource, TResult> selector)
|
|
{
|
|
if (items == null) return new List<TResult>();
|
|
|
|
var list = new List<TResult>();
|
|
foreach (var item in items) list.Add(selector.Invoke(item));
|
|
return list;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|