SpanDebugView.cs 657 B

1234567891011121314151617181920212223242526
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Diagnostics;
  5. namespace System
  6. {
  7. internal sealed class SpanDebugView<T>
  8. {
  9. private readonly T[] _array;
  10. public SpanDebugView(Span<T> span)
  11. {
  12. _array = span.ToArray();
  13. }
  14. public SpanDebugView(ReadOnlySpan<T> span)
  15. {
  16. _array = span.ToArray();
  17. }
  18. [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
  19. public T[] Items => _array;
  20. }
  21. }