JD2022-TU1/main/tools/framework/JD.Collections/CollectionDebugView.cs

30 lines
No EOL
740 B
C#

using System.Collections.Generic;
using System.Diagnostics;
namespace JD.Collections
{
internal sealed class CollectionDebugView<T>
{
readonly private ICollection<T> collection;
public CollectionDebugView(ICollection<T> collection)
{
if (collection == null)
{
ThrowHelper.ThrowArgumentNullException();
}
this.collection = collection;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items
{
get
{
T[] array = new T[this.collection.Count];
this.collection.CopyTo(array, 0);
return array;
}
}
}
}