summary refs log tree commit diff
path: root/LibGit/Extensions/QueueExtensions.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-05 03:25:53 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-05 03:25:53 +0200
commit51d820e22a4517dbb06d38a4f07f7c48522ef811 (patch)
tree4a7749cf77223dff2414fd4b73cb17df43d7449e /LibGit/Extensions/QueueExtensions.cs
downloadGitTools-51d820e22a4517dbb06d38a4f07f7c48522ef811.tar.xz
Initial commit HEAD master
Diffstat (limited to 'LibGit/Extensions/QueueExtensions.cs')
-rw-r--r--LibGit/Extensions/QueueExtensions.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/LibGit/Extensions/QueueExtensions.cs b/LibGit/Extensions/QueueExtensions.cs
new file mode 100644
index 0000000..45b8093
--- /dev/null
+++ b/LibGit/Extensions/QueueExtensions.cs
@@ -0,0 +1,26 @@
+namespace LibGit.Extensions;
+
+public static class QueueExtensions
+{
+public static IEnumerable<T> Dequeue<T>(this Queue<T> queue, int count)
+{
+    for (int i = 0; i < count; i++)
+    {
+        yield return queue.Dequeue();
+    }
+}
+    public static IEnumerable<T> Peek<T>(this Queue<T> queue, int count)
+    {
+        for (int i = 0; i < count; i++)
+        {
+            yield return queue.ElementAt(i);
+        }
+    }
+    public static void Drop<T>(this Queue<T> queue, int count)
+    {
+        for (int i = 0; i < count; i++)
+        {
+            queue.Dequeue();
+        }
+    }
+}
\ No newline at end of file