diff --git a/csharp/Lib/Utils/EnumerableUtils.cs b/csharp/Lib/Utils/EnumerableUtils.cs index af9cc1998..609258c37 100644 --- a/csharp/Lib/Utils/EnumerableUtils.cs +++ b/csharp/Lib/Utils/EnumerableUtils.cs @@ -68,7 +68,23 @@ public static class EnumerableUtils // } + public static Queue ToQueue(this IEnumerable ts) + { + var q = new Queue(); + foreach (var t in ts) + q.Enqueue(t); + return q; + } + + public static Stack ToStack(this IEnumerable ts) + { + var s = new Stack(); + foreach (var t in ts) + s.Push(t); + + return s; + } public static async IAsyncEnumerable SelectManyAsync(this IEnumerable ts, Func>> func)