Skip to content

In from-string conversions, also honor IParsable<T> interface implementations, not just public static Parse methods #28222

Open

Description

Summary of the new feature / enhancement

A type that implements IParsable<TSelf> signals that an instance of it can be constructed from a string, by way of the interface's static Parse (or TryParse) method.

Currently, PowerShell seemingly only looks for a publicParse method directly on a type, irrespective of any interface implementations.

Thus:

  • if a type implements IParsable<TSelf> implicitly, it by definition has a public Parse method and PowerShell will use it.
  • However, it will not honor an explicitly implemented IParsable<TSelf>, due to the absence of a public Parse method directly on the type.

PowerShell should always honor the IParsable<TSelf> interface, given the express purpose of the interface, irrespective of whether a given type implements said interface implicitly or explicitly.


For instance, starting in .NET 11 System.Text.Rune implements IParsable<Rune> (as well as ISpanParsable<Rune>, but spans can't be used in PowerShell), but does so explicitly, i.e. the static Parse method isn't directly available on the type.

If PowerShell supported such implicit IParsable<TSelf> implementations, then the following, as requested in

# Currently FAILS, but would work in .NET 11+,
# once PowerShell also supports *explicit* IParsable<TSelf> implementations
[System.Text.Rune] '👍'

Proposed technical implementation details (optional)

No response

Activity

  1. added
    Issue-Enhancement
    Needs-Triage
    on Oct 16, 2026
  2. changed the title [-]In from-string conversions, also honor explicitly implemented `IParsable<T>` interface implementation, not just public static `Parse` methods[/-] [+]In from-string conversions, also honor explicitly implemented `IParsable<T>` interface implementations, not just public static `Parse` methods[/+] on Oct 16, 2026
  3. GeeLaw commented on Oct 16, 2026

    @GeeLaw
  4. mklement0 commented on Oct 16, 2026

    @mklement0
    Author
  5. changed the title [-]In from-string conversions, also honor explicitly implemented `IParsable<T>` interface implementations, not just public static `Parse` methods[/-] [+]In from-string conversions, also honor explicit `IParsable<T>` interface implementations, not just public static `Parse` methods[/+] on Oct 16, 2026
  6. GeeLaw commented on Oct 16, 2026

    @GeeLaw
  7. changed the title [-]In from-string conversions, also honor explicit `IParsable<T>` interface implementations, not just public static `Parse` methods[/-] [+]In from-string conversions, also honor `IParsable<T>` interface implementations, not just public static `Parse` methods[/+] on Oct 16, 2026
  8. mklement0 commented on Oct 16, 2026

    @mklement0
    Author
  9. GeeLaw commented on Oct 16, 2026

    @GeeLaw
  10. mklement0 commented on Oct 16, 2026

    @mklement0
    Author
  11. added
    WG-Engine
    on Oct 17, 2026
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

    Issue-EnhancementNeeds-TriageWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions