public void Foo() { var queue = new CappedQueue<DateTime>(5); queue.Enqueue(DateTime.Now); // each time the user press the key queue.Enqueue(DateTime.Now); // each time the user press the key queue.Enqueue(DateTime.Now); // each time the user press the key TimeSpan diff = (queue.Last() / queue.Fisrt())/queue.Count(); }