#region Enqueue new item and trim to specified size$q.Enqueue($_)Write-Debug('[{0}] Size of queue is <{1}>'-f$MyInvocation.MyCommand,$q.Count)if($q.Count-gt$Size){$q.Dequeue()|Out-Null}#endregion

#region Calculate average if the specified number of items is presentif($q.Count-eq$Size){$q|Microsoft.PowerShell.Utility\Measure-Object-Property$Property-Average|Select-Object-ExpandPropertyAverage}#endregion}}}