Skip to content

Add String Span-based method for writing into String's buffer #22819

@stephentoub

Description

@stephentoub

Separated out of https://github.com/dotnet/corefx/issues/21281 for tracking purposes.

  • Implement in System.Private.CoreLib in coreclr
  • Implement in System.Private.CoreLib in corert (if string isn't yet "shared" between coreclr and corert)
  • Expose from System.Runtime contract in corefx
  • Add tests to System.Runtime tests in corefx
namespace System
{
    public delegate void StringCreateAction<TState>(TState state, Span<char> destination);

    public class String
    {
        public static string Create<TState>(int length, TState state, StringCreateAction action);}
}

Mostly approved, but open issue around the delegate, its name, what namespace it lives in (or nested type within String), etc. A custom delegate is needed as span can't be used as a generic type argument with one of the built-in action types.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions