using System;
using System.Diagnostics;
namespace ComputeSharp.Resources.Views
{
///
/// A debug proxy used to display items in a instance.
///
/// The type of items to display.
internal sealed class BufferDebugView
where T : unmanaged
{
///
/// Initializes a new instance of the class with the specified parameters.
///
/// The input instance with the items to display.
public BufferDebugView(Buffer? buffer)
{
if (buffer is not null)
{
var items = GC.AllocateUninitializedArray(buffer.Length);
buffer.GetData(ref items[0], buffer.Length, 0);
Items = items;
}
}
///
/// Gets the items to display for the current instance.
///
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
public T[]? Items { get; }
}
}