Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Version Span-based APIs #22815

Closed
1 of 3 tasks
stephentoub opened this issue Jul 18, 2017 · 1 comment
Closed
1 of 3 tasks

Add Version Span-based APIs #22815

stephentoub opened this issue Jul 18, 2017 · 1 comment
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.Runtime tenet-performance Performance related issue
Milestone

Comments

@stephentoub
Copy link
Member

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

  • Implement in System.Private.CoreLib in coreclr (corert shares the same files)
  • Expose from System.Runtime contract in corefx
  • Add tests to System.Runtime tests in corefx
namespace System
{
    public class Version
    {
        public static Version Parse(ReadOnlySpan<char> input);
        public static bool TryParse(ReadOnlySpan<char> input, out Version result);
        public bool TryFormat(Span<char> destination, out int charsWritten, int fieldCount = 4);}
}

EDIT 8/17/2017:
We'd approved:

public bool TryFormat(Span<char> destination, out int charsWritten, int fieldCount = 4);

as a way to avoid needing to add two TryFormat overloads based on whether it takes a fieldCount or not, but it turns out that deviates from the ToString()/ToString(fieldCount) behavior, where the former doesn't always use fieldCount == 4 but rather dynamically determines the value based on the instance, so we should add both:

public bool TryFormat(Span<char> destination, out int charsWritten);
public bool TryFormat(Span<char> destination, int fieldCount, out int charsWritten);
@kassemsandarusi
Copy link
Contributor

It is likely I am incorrect, but this issue seems dependent on dotnet/corefx#22403. In order to Parse the version, you likely need:

namespace System
{
    public struct Int32 {
        public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out Int32 result)
    }
}

@stephentoub stephentoub self-assigned this Aug 17, 2017
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-System.Runtime tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

3 participants