This fixes the net40 target so it supports key features in
System.Memory
System.Buffers
System.Runtime.CompilerServices.Unsafe
which can significantly reduce allocations when used. All of the features in these libraries can now be utilized without conditionally compiling. It also means that the ref struct ValueStringBuilder can now be utilized on net40 as well, further reducing conditional compilation.
This PR does not (yet) remove the conditional compilation. But with this in place, we can remove:
FEATURE_SPAN
FEATURE_ARRAYPOOL
Most code generation, since we can normalize to ReadOnlySpan<char> and Memory<char>
A lot of duplicated code, since all platforms will be able to support ReadOnlySpan<char> and Memory<char>
All ICharSequence overloads that accept char[], StringBuilder, and ICharSequence
The plan is to use ReadOnlySpan<char> to replace the Java-like ICharSequence in most places. Where the stack is not available (types that would be difficult to convert to ref structs), we can use ReadOnlyMemory<char>. To match the BCL, we will provide overloads that accept string that simply cascade the call to the ReadOnlySpan<char> or ReadOnlyMemory<char> implementation.
StringBuilder internally will be replaced with ValueStringBuilder, which is readily convertible to ReadOnlySpan<char>.
This PR also disables the tests that require IKVM and removes the reference, since it no longer compiles. This will need to be revisited again at some point.
This fixes the net40 target so it supports key features in
which can significantly reduce allocations when used. All of the features in these libraries can now be utilized without conditionally compiling. It also means that the ref struct
ValueStringBuilder
can now be utilized on net40 as well, further reducing conditional compilation.This PR does not (yet) remove the conditional compilation. But with this in place, we can remove:
FEATURE_SPAN
FEATURE_ARRAYPOOL
ReadOnlySpan<char>
andMemory<char>
ReadOnlySpan<char>
andMemory<char>
ICharSequence
overloads that acceptchar[]
,StringBuilder
, andICharSequence
The plan is to use
ReadOnlySpan<char>
to replace the Java-likeICharSequence
in most places. Where the stack is not available (types that would be difficult to convert to ref structs), we can useReadOnlyMemory<char>
. To match the BCL, we will provide overloads that accept string that simply cascade the call to theReadOnlySpan<char>
orReadOnlyMemory<char>
implementation.StringBuilder
internally will be replaced withValueStringBuilder
, which is readily convertible toReadOnlySpan<char>
.This PR also disables the tests that require IKVM and removes the reference, since it no longer compiles. This will need to be revisited again at some point.