Removed duplicate implicit conversion from Span to ReadOnlySpan
ReadOnlySpan and Span both define conversions from Span to ReadOnlySpan, making it impossible to actually convert between them (see image). The C# runtime source code for Span does define a conversion while ReadOnlySpan doesn't.
Fixed ReadOnlySpan's ToString format
ReadOnlySpan's ToString() method should return System.ReadOnlySpan<T>[x] according to the runtime source, but in this library it returns System.Span<T>[x].
Added char concatenation if ReadOnlySpan and Span generic is char
Both Span's and ReadOnlySpan's ToString() method do not implement char concatenation, which makes sense as Unsafe.As<T> is not easy, if not impossible to port. However StringBuilder might be a decent alternative, it's slower but I think it's worth sacrificing performance in this case. You can also perhaps implement the pattern shown in that commit to polyfill most of the remainder missing code in MemoryExtensions.
Problems that this pull request addresses
Removed duplicate implicit conversion from Span to ReadOnlySpan
ReadOnlySpan
andSpan
both define conversions fromSpan
toReadOnlySpan
, making it impossible to actually convert between them (see image). The C# runtime source code forSpan
does define a conversion whileReadOnlySpan
doesn't.Fixed ReadOnlySpan's ToString format
ReadOnlySpan
'sToString()
method should returnSystem.ReadOnlySpan<T>[x]
according to the runtime source, but in this library it returnsSystem.Span<T>[x]
.Added char concatenation if ReadOnlySpan and Span generic is char
Span
's andReadOnlySpan
'sToString()
method do not implementchar
concatenation, which makes sense asUnsafe.As<T>
is not easy, if not impossible to port. HoweverStringBuilder
might be a decent alternative, it's slower but I think it's worth sacrificing performance in this case. You can also perhaps implement the pattern shown in that commit to polyfill most of the remainder missing code inMemoryExtensions
.