private static async Task <IQueue <TItem> > CloneAsync(IQueue <TItem> queue) { var cloneable = queue as ICloneable; if (cloneable != null) { return((IQueue <TItem>)cloneable.Clone()); } var clone = new Memory.Queue <TItem>(); await queue.CopyToAsync(clone).ConfigureAwait(false); return(clone); }