[API Proposal]: Implement ISpanParsable on System.Version
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Background and motivation
System.Version implements IUtf8SpanParsable, but not ISpanParsable (nor IParsable). It seems reasonable to add (explicit) implementations.
### API Proposal
```diff
namespace System;
public class Version :
ICloneable,
IComparable,
IComparable,
IEquatable,
ISpanFormattable,
IUtf8SpanFormattable,
IUtf8SpanParsable,
+ ISpanParsable
{
public static Version Parse(string input);
+ static Version IParsable.Parse(string s, IFormatProvider? provider);
public static Version Parse(ReadOnlySpan input);
+ static Version ISpanParsable.Parse(ReadOnlySpan s, IFormatProvider? provider);
public static Version Parse(ReadOnlySpan utf8Text);
static Version IUtf8SpanParsable.Parse(ReadOnlySpan utf8Text, IFormatProvider? provider);
public static bool TryParse([NotNullWhen(true)] string? input, [NotNullWhen(true)] out Version? result);
+ static bool IParsable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [NotNullWhen(true)] out Version? result);
public static bool TryParse(ReadOnlySpan input, [NotNullWhen(true)] out Version? result);
+ static bool ISpanParsable.TryParse(ReadOnlySpan s, IFormatProvider? provider, [NotNullWhen(true)] out Version? result);
public static bool TryParse(ReadOnlySpan utf8Text, [NotNullWhen(true)] out Version? result);
static bool IUtf8SpanParsable.TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [NotNullWhen(true)] out Version? result);
}
```
### API Usage
### Alternative Designs
_No response_
### Risks
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.