add ToQueue and ToStack
This commit is contained in:
parent
65dd23bd8e
commit
ba54f9e325
|
@ -68,7 +68,23 @@ public static class EnumerableUtils
|
|||
// }
|
||||
|
||||
|
||||
public static Queue<T> ToQueue<T>(this IEnumerable<T> ts)
|
||||
{
|
||||
var q = new Queue<T>();
|
||||
foreach (var t in ts)
|
||||
q.Enqueue(t);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
public static Stack<T> ToStack<T>(this IEnumerable<T> ts)
|
||||
{
|
||||
var s = new Stack<T>();
|
||||
foreach (var t in ts)
|
||||
s.Push(t);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public static async IAsyncEnumerable<R>
|
||||
SelectManyAsync<T, R>(this IEnumerable<T> ts, Func<T, Task<IEnumerable<R>>> func)
|
||||
|
|
Loading…
Reference in New Issue