mirror of https://github.com/ogoun/Zero.git
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.
46 lines
1.2 KiB
46 lines
1.2 KiB
using System.Collections.Generic;
|
|
|
|
namespace MemoryPools.Collections.Specialized
|
|
{
|
|
public static partial class AsSingleQueryList
|
|
{
|
|
public static IPoolingEnumerable<T> AsSingleEnumerableList<T>(this IEnumerable<T> src)
|
|
{
|
|
var list = Pool<PoolingList<T>>.Get().Init();
|
|
foreach (var item in src)
|
|
{
|
|
list.Add(item);
|
|
}
|
|
return Pool<EnumerableTyped<T>>.Get().Init(list);
|
|
}
|
|
|
|
public static IPoolingEnumerable<T> AsSingleEnumerableSharedList<T>(this IEnumerable<T> src) where T : class
|
|
{
|
|
var list = Pool<PoolingListCanon<T>>.Get().Init();
|
|
foreach (var item in src)
|
|
{
|
|
list.Add(item);
|
|
}
|
|
return Pool<EnumerableShared<T>>.Get().Init(list);
|
|
}
|
|
public static IPoolingEnumerable<T> AsSingleEnumerableList<T>(this IPoolingEnumerable<T> src)
|
|
{
|
|
var list = Pool<PoolingList<T>>.Get().Init();
|
|
foreach (var item in src)
|
|
{
|
|
list.Add(item);
|
|
}
|
|
return Pool<EnumerableTyped<T>>.Get().Init(list);
|
|
}
|
|
|
|
public static IPoolingEnumerable<T> AsSingleEnumerableSharedList<T>(this IPoolingEnumerable<T> src) where T : class
|
|
{
|
|
var list = Pool<PoolingListCanon<T>>.Get().Init();
|
|
foreach (var item in src)
|
|
{
|
|
list.Add(item);
|
|
}
|
|
return Pool<EnumerableShared<T>>.Get().Init(list);
|
|
}
|
|
}
|
|
} |