mirror of
https://github.com/CommunityToolkit/dotnet.git
synced 2026-10-29 11:36:51 +08:00
Removed unnecessary constructor parameter
This commit is contained in:
@@ -24,10 +24,9 @@ namespace Microsoft.Toolkit.HighPerformance.Streams
|
||||
/// Initializes a new instance of the <see cref="IMemoryOwnerStream{TSource}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="source">The input <typeparamref name="TSource"/> instance to use.</param>
|
||||
/// <param name="isReadOnly">Indicates whether <paramref name="source"/> can be written to.</param>
|
||||
/// <param name="disposable">The <see cref="IDisposable"/> instance currently in use.</param>
|
||||
public IMemoryOwnerStream(TSource source, bool isReadOnly, IDisposable disposable)
|
||||
: base(source, isReadOnly)
|
||||
public IMemoryOwnerStream(TSource source, IDisposable disposable)
|
||||
: base(source, false)
|
||||
{
|
||||
this.disposable = disposable;
|
||||
}
|
||||
|
||||
@@ -56,18 +56,18 @@ namespace Microsoft.Toolkit.HighPerformance.Streams
|
||||
{
|
||||
var arraySpanSource = new ArrayOwner(segment.Array!, segment.Offset, segment.Count);
|
||||
|
||||
return new IMemoryOwnerStream<ArrayOwner>(arraySpanSource, false, memoryOwner);
|
||||
return new IMemoryOwnerStream<ArrayOwner>(arraySpanSource, memoryOwner);
|
||||
}
|
||||
|
||||
if (MemoryMarshal.TryGetMemoryManager<byte, MemoryManager<byte>>(memory, out var memoryManager, out int start, out int length))
|
||||
{
|
||||
MemoryManagerOwner memoryManagerSpanSource = new MemoryManagerOwner(memoryManager, start, length);
|
||||
|
||||
return new IMemoryOwnerStream<MemoryManagerOwner>(memoryManagerSpanSource, false, memoryOwner);
|
||||
return new IMemoryOwnerStream<MemoryManagerOwner>(memoryManagerSpanSource, memoryOwner);
|
||||
}
|
||||
|
||||
// Return an empty stream if the memory was empty
|
||||
return new IMemoryOwnerStream<ArrayOwner>(ArrayOwner.Empty, false, memoryOwner);
|
||||
return new IMemoryOwnerStream<ArrayOwner>(ArrayOwner.Empty, memoryOwner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user