summary refs log tree commit diff
path: root/LibGit/Extensions/QueueExtensions.cs
blob: 45b8093df18bb5d753963a687fce3623ea23541b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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();
        }
    }
}