// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics; namespace System.Collections.Concurrent { /// /// A debugger view of the IProducerConsumerCollection that makes it simple to browse the /// collection's contents at a point in time. /// /// The type of elements stored within. internal sealed class ProducerConsumerCollectionDebugView { private readonly IProducerConsumerCollection _collection; // The collection being viewed. /// /// Constructs a new debugger view object for the provided collection object. /// /// A collection to browse in the debugger. internal ProducerConsumerCollectionDebugView(IProducerConsumerCollection collection) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } _collection = collection; } /// /// Returns a snapshot of the underlying collection's elements. /// [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] internal T[] Items { get { return _collection.ToArray(); } } } }