-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Type of issue
Misleading wording.
Description
Two ReadOnlyMemory objects are equal if the memory regions point to the same array and have the same length. The method does not check to see if the contents are equal.
The wording here sounds like the ReadOnlyMemory<T> only compares _object and _length 1 internally, ignoring the actual offset of the slice. The implementation seems to do the sensible thing 2 and return true iff both instances point to the same memory region, however (at least on a naive read-through; I'm not sure about the possible edge cases the internal constructor 3 might introduce).
Page URL
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System/ReadOnlyMemory`1.xml
Document Version Independent Id
c8fe03ad-b230-bf63-cd15-c862faa1eb22
Platform Id
ef16dd22-d568-3bdd-b282-372e16488fd6
Article author
Footnotes
-
https://github.com/dotnet/runtime/blob/a962f34b0d502d551534bec84493edee67783771/src/libraries/System.Private.CoreLib/src/System/ReadOnlyMemory.cs#L26 ↩
-
https://github.com/dotnet/runtime/blob/a962f34b0d502d551534bec84493edee67783771/src/libraries/System.Private.CoreLib/src/System/ReadOnlyMemory.cs#L383 ↩
-
https://github.com/dotnet/runtime/blob/a962f34b0d502d551534bec84493edee67783771/src/libraries/System.Private.CoreLib/src/System/ReadOnlyMemory.cs#L93 ↩