Skip to content

Commit 15a0c3b

Browse files
committed
Minor code tweaks
1 parent 9d8cff6 commit 15a0c3b

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

Microsoft.Toolkit.Mvvm/Messaging/WeakRefMessenger.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Buffers;
99
using System.Collections.Generic;
1010
using System.Runtime.CompilerServices;
11-
using System.Runtime.InteropServices;
1211
using Microsoft.Collections.Extensions;
1312
using Microsoft.Toolkit.Mvvm.Messaging.Internals;
1413

@@ -293,7 +292,7 @@ public void Reset()
293292
/// A simple buffer writer implementation using pooled arrays.
294293
/// </summary>
295294
/// <typeparam name="T">The type of items to store in the list.</typeparam>
296-
public sealed class ArrayPoolBufferWriter<T> : IDisposable
295+
private sealed class ArrayPoolBufferWriter<T> : IDisposable
297296
{
298297
/// <summary>
299298
/// The default buffer size to use to expand empty arrays.
@@ -325,17 +324,7 @@ public ArrayPoolBufferWriter()
325324
public ReadOnlySpan<T> Span
326325
{
327326
[MethodImpl(MethodImplOptions.AggressiveInlining)]
328-
get
329-
{
330-
T[] array = this.array;
331-
332-
if (this.index > 0)
333-
{
334-
return MemoryMarshal.CreateReadOnlySpan(ref array[0], this.index);
335-
}
336-
337-
return default;
338-
}
327+
get => this.array.AsSpan(0, this.index);
339328
}
340329

341330
/// <summary>

0 commit comments

Comments
 (0)