Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Mirror changes from dotnet/corert #15518

Merged
merged 1 commit into from
Dec 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/mscorlib/shared/System/ReadOnlySpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,18 @@ public bool IsEmpty
/// <exception cref="System.IndexOutOfRangeException">
/// Thrown when index less than 0 or index greater than or equal to Length
/// </exception>
public T this[int index]
{
#if PROJECTN
public ref readonly T this[int index]
{
[BoundsChecking]
get
{
return Unsafe.Add(ref _pointer.Value, index);
return ref Unsafe.Add(ref _pointer.Value, index);
}
}
#else
public T this[int index]
{
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[NonVersionable]
Expand All @@ -183,8 +186,8 @@ public T this[int index]
ThrowHelper.ThrowIndexOutOfRangeException();
return Unsafe.Add(ref _pointer.Value, index);
}
#endif
}
#endif

/// <summary>
/// Copies the contents of this read-only span into destination span. If the source
Expand Down