blob: 0205e068eadaf327199039b0ae9581d14f3561e2 (
plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// 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
{
/// <summary>
/// A debugger view of the IProducerConsumerCollection that makes it simple to browse the
/// collection's contents at a point in time.
/// </summary>
/// <typeparam name="T">The type of elements stored within.</typeparam>
internal sealed class IProducerConsumerCollectionDebugView<T>
{
private readonly IProducerConsumerCollection<T> _collection; // The collection being viewed.
/// <summary>
/// Constructs a new debugger view object for the provided collection object.
/// </summary>
/// <param name="collection">A collection to browse in the debugger.</param>
public IProducerConsumerCollectionDebugView(IProducerConsumerCollection<T> collection)
{
if (collection == null)
{
throw new ArgumentNullException(nameof(collection));
}
_collection = collection;
}
/// <summary>
/// Returns a snapshot of the underlying collection's elements.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items
{
get { return _collection.ToArray(); }
}
}
}
|