Minor code tweaks using target-typed new() expression
This commit is contained in:
Родитель
2ceb9090e9
Коммит
dc909db50c
|
@ -327,4 +327,4 @@ dotnet_diagnostic.SA1413.severity = none # UseTrailingCommasInMultiLineInitializ
|
|||
dotnet_diagnostic.SA1314.severity = none # TypeParameterNamesMustBeginWithT: We do have a few templates that don't start with T. We need to double check that changing this is not a breaking change. If not, we can re-enable this.
|
||||
dotnet_diagnostic.SA1000.severity = none # Hide warnings when using the new() expression from C# 9.
|
||||
dotnet_diagnostic.SA1313.severity = none # Hide warnings for record parameters.
|
||||
dotnet_diagnostic.SA1101.severity = none # Hide warnings when accessing properties without "this".
|
||||
dotnet_diagnostic.SA1101.severity = none # Hide warnings when accessing properties without "this".
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
public static MemoryOwner<T> Empty
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => new MemoryOwner<T>(0, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
get => new(0, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -103,7 +103,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static MemoryOwner<T> Allocate(int size) => new MemoryOwner<T>(size, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
public static MemoryOwner<T> Allocate(int size) => new(size, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MemoryOwner{T}"/> instance with the specified parameters.
|
||||
|
@ -115,7 +115,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static MemoryOwner<T> Allocate(int size, ArrayPool<T> pool) => new MemoryOwner<T>(size, pool, AllocationMode.Default);
|
||||
public static MemoryOwner<T> Allocate(int size, ArrayPool<T> pool) => new(size, pool, AllocationMode.Default);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MemoryOwner{T}"/> instance with the specified parameters.
|
||||
|
@ -127,7 +127,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static MemoryOwner<T> Allocate(int size, AllocationMode mode) => new MemoryOwner<T>(size, ArrayPool<T>.Shared, mode);
|
||||
public static MemoryOwner<T> Allocate(int size, AllocationMode mode) => new(size, ArrayPool<T>.Shared, mode);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MemoryOwner{T}"/> instance with the specified parameters.
|
||||
|
@ -140,7 +140,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static MemoryOwner<T> Allocate(int size, ArrayPool<T> pool, AllocationMode mode) => new MemoryOwner<T>(size, pool, mode);
|
||||
public static MemoryOwner<T> Allocate(int size, ArrayPool<T> pool, AllocationMode mode) => new(size, pool, mode);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of items in the current instance
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
public static SpanOwner<T> Empty
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => new SpanOwner<T>(0, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
get => new(0, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -92,7 +92,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SpanOwner<T> Allocate(int size) => new SpanOwner<T>(size, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
public static SpanOwner<T> Allocate(int size) => new(size, ArrayPool<T>.Shared, AllocationMode.Default);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SpanOwner{T}"/> instance with the specified parameters.
|
||||
|
@ -104,7 +104,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SpanOwner<T> Allocate(int size, ArrayPool<T> pool) => new SpanOwner<T>(size, pool, AllocationMode.Default);
|
||||
public static SpanOwner<T> Allocate(int size, ArrayPool<T> pool) => new(size, pool, AllocationMode.Default);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SpanOwner{T}"/> instance with the specified parameters.
|
||||
|
@ -116,7 +116,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SpanOwner<T> Allocate(int size, AllocationMode mode) => new SpanOwner<T>(size, ArrayPool<T>.Shared, mode);
|
||||
public static SpanOwner<T> Allocate(int size, AllocationMode mode) => new(size, ArrayPool<T>.Shared, mode);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SpanOwner{T}"/> instance with the specified parameters.
|
||||
|
@ -129,7 +129,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// <remarks>This method is just a proxy for the <see langword="private"/> constructor, for clarity.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SpanOwner<T> Allocate(int size, ArrayPool<T> pool, AllocationMode mode) => new SpanOwner<T>(size, pool, mode);
|
||||
public static SpanOwner<T> Allocate(int size, ArrayPool<T> pool, AllocationMode mode) => new(size, pool, mode);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of items in the current instance
|
||||
|
@ -183,7 +183,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ArraySegment<T> DangerousGetArray()
|
||||
{
|
||||
return new ArraySegment<T>(array!, 0, this.length);
|
||||
return new(array!, 0, this.length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
/// process. Since <see cref="StringPool"/> is thread-safe, the shared instance can be used
|
||||
/// concurrently by multiple threads without the need for manual synchronization.
|
||||
/// </remarks>
|
||||
public static StringPool Shared { get; } = new StringPool();
|
||||
public static StringPool Shared { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total number of <see cref="string"/> that can be stored in the current instance.
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SpanEnumerable<T> Enumerate<T>(this T[] array)
|
||||
{
|
||||
return new SpanEnumerable<T>(array);
|
||||
return new(array);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -172,7 +172,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
public static SpanTokenizer<T> Tokenize<T>(this T[] array, T separator)
|
||||
where T : IEquatable<T>
|
||||
{
|
||||
return new SpanTokenizer<T>(array, separator);
|
||||
return new(array, separator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Span2D<T> AsSpan2D<T>(this T[,]? array)
|
||||
{
|
||||
return new Span2D<T>(array);
|
||||
return new(array);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -231,7 +231,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Span2D<T> AsSpan2D<T>(this T[,]? array, int row, int column, int height, int width)
|
||||
{
|
||||
return new Span2D<T>(array, row, column, height, width);
|
||||
return new(array, row, column, height, width);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -244,7 +244,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Memory2D<T> AsMemory2D<T>(this T[,]? array)
|
||||
{
|
||||
return new Memory2D<T>(array);
|
||||
return new(array);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -268,7 +268,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Memory2D<T> AsMemory2D<T>(this T[,]? array, int row, int column, int height, int width)
|
||||
{
|
||||
return new Memory2D<T>(array, row, column, height, width);
|
||||
return new(array, row, column, height, width);
|
||||
}
|
||||
|
||||
#if SPAN_RUNTIME_SUPPORT
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Span2D<T> AsSpan2D<T>(this T[,,] array, int depth)
|
||||
{
|
||||
return new Span2D<T>(array, depth);
|
||||
return new(array, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -252,7 +252,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Memory2D<T> AsMemory2D<T>(this T[,,] array, int depth)
|
||||
{
|
||||
return new Memory2D<T>(array, depth);
|
||||
return new(array, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Memory2D<T> AsMemory2D<T>(this Memory<T> memory, int height, int width)
|
||||
{
|
||||
return new Memory2D<T>(memory, height, width);
|
||||
return new(memory, height, width);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -58,7 +58,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Memory2D<T> AsMemory2D<T>(this Memory<T> memory, int offset, int height, int width, int pitch)
|
||||
{
|
||||
return new Memory2D<T>(memory, offset, height, width, pitch);
|
||||
return new(memory, offset, height, width, pitch);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ReadOnlyMemory2D<T> AsMemory2D<T>(this ReadOnlyMemory<T> memory, int height, int width)
|
||||
{
|
||||
return new ReadOnlyMemory2D<T>(memory, height, width);
|
||||
return new(memory, height, width);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,7 +61,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ReadOnlyMemory2D<T> AsMemory2D<T>(this ReadOnlyMemory<T> memory, int offset, int height, int width, int pitch)
|
||||
{
|
||||
return new ReadOnlyMemory2D<T>(memory, offset, height, width, pitch);
|
||||
return new(memory, offset, height, width, pitch);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ReadOnlySpan2D<T> AsSpan2D<T>(this ReadOnlySpan<T> span, int height, int width)
|
||||
{
|
||||
return new ReadOnlySpan2D<T>(span, height, width);
|
||||
return new(span, height, width);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -206,7 +206,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ReadOnlySpan2D<T> AsSpan2D<T>(this ReadOnlySpan<T> span, int offset, int height, int width, int pitch)
|
||||
{
|
||||
return new ReadOnlySpan2D<T>(span, offset, height, width, pitch);
|
||||
return new(span, offset, height, width, pitch);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -313,7 +313,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ReadOnlySpanEnumerable<T> Enumerate<T>(this ReadOnlySpan<T> span)
|
||||
{
|
||||
return new ReadOnlySpanEnumerable<T>(span);
|
||||
return new(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -339,7 +339,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
public static ReadOnlySpanTokenizer<T> Tokenize<T>(this ReadOnlySpan<T> span, T separator)
|
||||
where T : IEquatable<T>
|
||||
{
|
||||
return new ReadOnlySpanTokenizer<T>(span, separator);
|
||||
return new(span, separator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Span2D<T> AsSpan2D<T>(this Span<T> span, int height, int width)
|
||||
{
|
||||
return new Span2D<T>(span, height, width);
|
||||
return new(span, height, width);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -108,7 +108,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Span2D<T> AsSpan2D<T>(this Span<T> span, int offset, int height, int width, int pitch)
|
||||
{
|
||||
return new Span2D<T>(span, offset, height, width, pitch);
|
||||
return new(span, offset, height, width, pitch);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -214,7 +214,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SpanEnumerable<T> Enumerate<T>(this Span<T> span)
|
||||
{
|
||||
return new SpanEnumerable<T>(span);
|
||||
return new(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -240,7 +240,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
public static SpanTokenizer<T> Tokenize<T>(this Span<T> span, T separator)
|
||||
where T : IEquatable<T>
|
||||
{
|
||||
return new SpanTokenizer<T>(span, separator);
|
||||
return new(span, separator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe UnsafeLock Enter(SpinLock* spinLock)
|
||||
{
|
||||
return new UnsafeLock(spinLock);
|
||||
return new(spinLock);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -97,7 +97,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Lock Enter(ref this SpinLock spinLock)
|
||||
{
|
||||
return new Lock(ref spinLock);
|
||||
return new(ref spinLock);
|
||||
}
|
||||
#else
|
||||
/// <summary>
|
||||
|
@ -123,7 +123,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Lock Enter(object owner, ref SpinLock spinLock)
|
||||
{
|
||||
return new Lock(owner, ref spinLock);
|
||||
return new(owner, ref spinLock);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ReadOnlySpanEnumerable<char> Enumerate(this string text)
|
||||
{
|
||||
return new ReadOnlySpanEnumerable<char>(text.AsSpan());
|
||||
return new(text.AsSpan());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -145,7 +145,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ReadOnlySpanTokenizer<char> Tokenize(this string text, char separator)
|
||||
{
|
||||
return new ReadOnlySpanTokenizer<char>(text.AsSpan(), separator);
|
||||
return new(text.AsSpan(), separator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -900,6 +900,6 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// <summary>
|
||||
/// Defines an implicit conversion of an array to a <see cref="Memory2D{T}"/>
|
||||
/// </summary>
|
||||
public static implicit operator Memory2D<T>(T[,]? array) => new Memory2D<T>(array);
|
||||
public static implicit operator Memory2D<T>(T[,]? array) => new(array);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -913,7 +913,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// <summary>
|
||||
/// Defines an implicit conversion of an array to a <see cref="ReadOnlyMemory2D{T}"/>
|
||||
/// </summary>
|
||||
public static implicit operator ReadOnlyMemory2D<T>(T[,]? array) => new ReadOnlyMemory2D<T>(array);
|
||||
public static implicit operator ReadOnlyMemory2D<T>(T[,]? array) => new(array);
|
||||
|
||||
/// <summary>
|
||||
/// Defines an implicit conversion of a <see cref="Memory2D{T}"/> to a <see cref="ReadOnlyMemory2D{T}"/>
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// </returns>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Enumerator GetEnumerator() => new Enumerator(this);
|
||||
public Enumerator GetEnumerator() => new(this);
|
||||
|
||||
/// <summary>
|
||||
/// Provides an enumerator for the elements of a <see cref="ReadOnlySpan2D{T}"/> instance.
|
||||
|
|
|
@ -1012,7 +1012,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// Implicily converts a given 2D array into a <see cref="ReadOnlySpan2D{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="array">The input 2D array to convert.</param>
|
||||
public static implicit operator ReadOnlySpan2D<T>(T[,]? array) => new ReadOnlySpan2D<T>(array);
|
||||
public static implicit operator ReadOnlySpan2D<T>(T[,]? array) => new(array);
|
||||
|
||||
/// <summary>
|
||||
/// Implicily converts a given <see cref="Span2D{T}"/> into a <see cref="ReadOnlySpan2D{T}"/> instance.
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// </returns>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Enumerator GetEnumerator() => new Enumerator(this);
|
||||
public Enumerator GetEnumerator() => new(this);
|
||||
|
||||
/// <summary>
|
||||
/// Provides an enumerator for the elements of a <see cref="Span2D{T}"/> instance.
|
||||
|
|
|
@ -1168,6 +1168,6 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// Implicily converts a given 2D array into a <see cref="Span2D{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="array">The input 2D array to convert.</param>
|
||||
public static implicit operator Span2D<T>(T[,]? array) => new Span2D<T>(array);
|
||||
public static implicit operator Span2D<T>(T[,]? array) => new(array);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator NullableReadOnlyRef<T>(Ref<T> reference)
|
||||
{
|
||||
return new NullableReadOnlyRef<T>(reference.Span);
|
||||
return new(reference.Span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -102,7 +102,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator NullableReadOnlyRef<T>(ReadOnlyRef<T> reference)
|
||||
{
|
||||
return new NullableReadOnlyRef<T>(reference.Span);
|
||||
return new(reference.Span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -112,7 +112,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator NullableReadOnlyRef<T>(NullableRef<T> reference)
|
||||
{
|
||||
return new NullableReadOnlyRef<T>(reference.Span);
|
||||
return new(reference.Span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator NullableRef<T>(Ref<T> reference)
|
||||
{
|
||||
return new NullableRef<T>(reference.Span);
|
||||
return new(reference.Span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlyRef<T>(Ref<T> reference)
|
||||
{
|
||||
return new ReadOnlyRef<T>(in reference.Value);
|
||||
return new(in reference.Value);
|
||||
}
|
||||
#else
|
||||
/// <summary>
|
||||
|
@ -117,7 +117,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlyRef<T>(Ref<T> reference)
|
||||
{
|
||||
return new ReadOnlyRef<T>(reference.Owner, reference.Offset);
|
||||
return new(reference.Owner, reference.Offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Microsoft.Toolkit.HighPerformance.Streams
|
|||
public static ArrayOwner Empty
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => new ArrayOwner(Array.Empty<byte>(), 0, 0);
|
||||
get => new(Array.Empty<byte>(), 0, 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче