You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In from-string conversions, also honor IParsable<T> interface implementations, not just public static Parse methods #28222
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
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
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
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
Activity
[-]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[/+]GeeLaw commentedon Oct 16, 2026
mklement0 commentedon Oct 16, 2026
[-]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[/+]GeeLaw commentedon Oct 16, 2026
[-]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[/+]mklement0 commentedon Oct 16, 2026
GeeLaw commentedon Oct 16, 2026
mklement0 commentedon Oct 16, 2026