// 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 CommunityToolkit.HighPerformance.Memory.Views; /// /// A debug proxy used to display items in a 2D layout. /// /// The type of items to display. internal sealed class MemoryDebugView2D { /// /// Initializes a new instance of the class with the specified parameters. /// /// The input instance with the items to display. public MemoryDebugView2D(Memory2D memory) { this.Items = memory.ToArray(); } /// /// Initializes a new instance of the class with the specified parameters. /// /// The input instance with the items to display. public MemoryDebugView2D(ReadOnlyMemory2D memory) { this.Items = memory.ToArray(); } /// /// Initializes a new instance of the class with the specified parameters. /// /// The input instance with the items to display. public MemoryDebugView2D(Span2D span) { this.Items = span.ToArray(); } /// /// Initializes a new instance of the class with the specified parameters. /// /// The input instance with the items to display. public MemoryDebugView2D(ReadOnlySpan2D span) { this.Items = span.ToArray(); } /// /// Gets the items to display for the current instance /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[,]? Items { get; } }