Skip to content

ISpanFormattable / TryFormat for ranges, range sets and value sets #41

Open

Description

@CaffeinatedCoder

Implement ISpanFormattable (TryFormat) on the range unions, RangeSet and the value sets, so formatting into a span or an interpolated string handler doesn't allocate an intermediate string.

The output must be the same as ToString byte for byte, and the same provider rule applies: without a format string the result is the invariant literal, whatever the provider. LiteralProviderContractTests and LiteralCultureContractTests should sweep TryFormat as well.

Activity

  1. added this to the 9.1.0 milestone on Oct 17, 2026
  2. removed this from the 9.1.0 milestone on Oct 17, 2026
  3. CaffeinatedCoder commented on Oct 17, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Moved off 9.1.0 into the backlog (#83), with no milestone.

    release/9.x has been cut, and 9.1.0 ships with the work that's already finished. Nothing has started on this issue, and it shouldn't hold up the tag. This is an addition, so the 10.0.0 epic (#58) doesn't take it either: that epic is kept to the silent and breaking fixes so they aren't held up behind new features.

    When someone picks it up, it goes under the epic of the release it will ship in and takes that milestone. A 9.x minor would need the change cherry-picked onto release/9.x.

  4. CaffeinatedCoder commented on Oct 17, 2026

    @CaffeinatedCoder
    OwnerAuthor

    From the comparable-library survey (2026-10-17): add IUtf8SpanFormattable and IUtf8SpanParsable<TSelf> to the scope. The literal is ASCII except for element text, so a UTF-8 TryFormat/TryParse pair lets Utf8JsonWriter.WriteStringValue(ReadOnlySpan<byte>) and the EF JsonValueReaderWriter paths skip the string. Same contract: byte-for-byte the invariant literal, provider ignored without a format string, swept by LiteralProviderContractTests and LiteralCultureContractTests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/literalsParse, TryParse and formattingenhancementNew feature or requestpackage/coreAffects CodoMetis.ValueRangespackage/nodatimeAffects CodoMetis.ValueRanges.NodaTime

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions