File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -780,14 +780,14 @@ public bool TryCopyTo(Span2D<T> destination)
780780 /// <returns>A reference to the 0th element, or a <see langword="null"/> reference.</returns>
781781 [ MethodImpl( MethodImplOptions. AggressiveInlining) ]
782782 [ EditorBrowsable( EditorBrowsableState. Never) ]
783- public unsafe ref T GetPinnableReference( )
783+ public unsafe ref readonly T GetPinnableReference( )
784784 {
785- ref T r0 = ref Unsafe. AsRef< T> ( null ) ;
785+ ref readonly T r0 = ref Unsafe. AsRef< T> ( null ) ;
786786
787787 if ( Length != 0 )
788788 {
789789#if NET7_0_OR_GREATER
790- r0 = ref Unsafe . AsRef ( in this . reference) ;
790+ r0 = ref this . reference;
791791#elif NETSTANDARD2_1_OR_GREATER
792792 r0 = ref MemoryMarshal. GetReference( this . span) ;
793793#else
Original file line number Diff line number Diff line change @@ -351,7 +351,7 @@ public unsafe void Test_ReadOnlySpan2DT_GetPinnableReference()
351351 {
352352 Assert . IsTrue ( Unsafe . AreSame (
353353 ref Unsafe . AsRef < int > ( null ) ,
354- ref ReadOnlySpan2D < int > . Empty . GetPinnableReference ( ) ) ) ;
354+ ref Unsafe . AsRef ( in ReadOnlySpan2D < int > . Empty . GetPinnableReference ( ) ) ) ) ;
355355
356356 int [ , ] array =
357357 {
@@ -361,7 +361,7 @@ ref Unsafe.AsRef<int>(null),
361361
362362 ReadOnlySpan2D < int > span2d = new ( array ) ;
363363
364- ref int r0 = ref span2d . GetPinnableReference ( ) ;
364+ ref int r0 = ref Unsafe . AsRef ( in span2d . GetPinnableReference ( ) ) ;
365365
366366 Assert . IsTrue ( Unsafe . AreSame ( ref r0 , ref array [ 0 , 0 ] ) ) ;
367367 }
You can’t perform that action at this time.
0 commit comments