Skip to content

Commit 18477f6

Browse files
author
LoneWandererProductions
committed
Add some debug stuff
1 parent 32f3dbd commit 18477f6

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

ExtendedSystemObjects/UnmanagedIntList.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using System;
1515
using System.Collections;
1616
using System.Collections.Generic;
17+
using System.Diagnostics;
1718
using System.Runtime.InteropServices;
1819
using ExtendedSystemObjects.Helper;
1920
using ExtendedSystemObjects.Interfaces;
@@ -27,6 +28,7 @@ namespace ExtendedSystemObjects
2728
/// Designed for scenarios where manual memory management is needed.
2829
/// </summary>
2930
/// <seealso cref="T:System.IDisposable" />
31+
[DebuggerDisplay("{ToString()}")]
3032
public sealed unsafe class UnmanagedIntList : IUnmanagedArray<int>, IEnumerable<int>
3133
{
3234
/// <summary>
@@ -300,6 +302,30 @@ public Span<int> AsSpan()
300302
return new Span<int>(_ptr, Capacity);
301303
}
302304

305+
306+
/// <summary>
307+
/// Converts to string.
308+
/// </summary>
309+
/// <returns>
310+
/// A <see cref="System.String" /> that represents this instance.
311+
/// </returns>
312+
public override string ToString()
313+
{
314+
var sb = new System.Text.StringBuilder();
315+
316+
for (int i = 0; i < Length; i++)
317+
{
318+
sb.Append(_ptr[i]);
319+
if (i < Length - 1)
320+
{
321+
sb.Append(", ");
322+
}
323+
}
324+
325+
return sb.ToString();
326+
}
327+
328+
303329
/// <summary>
304330
/// Finalizes an instance of the <see cref="UnmanagedIntList" /> class, releasing unmanaged resources.
305331
/// </summary>

0 commit comments

Comments
 (0)