MemoryDebugView.cs 680 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 MemoryDebugView<T>
  8. {
  9. private readonly ReadOnlyMemory<T> _memory;
  10. public MemoryDebugView(Memory<T> memory)
  11. {
  12. _memory = memory;
  13. }
  14. public MemoryDebugView(ReadOnlyMemory<T> memory)
  15. {
  16. _memory = memory;
  17. }
  18. [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
  19. public T[] Items => _memory.ToArray();
  20. }
  21. }