net90_PropertyGridHelpers.Converters_IParsable 1 - dparvin/PropertyGridHelpers GitHub Wiki

IParsable<T> interface

Defines a contract for parsing a string representation into an instance of type T.

public interface IParsable<T>
parameter description
T The type that implements the parsing logic.

Members

name description
Parse(…) Converts the specified string representation into an instance of type T.

Remarks

This interface provides a way to support round-tripping between string values and strongly typed values, allowing custom parsing logic to be used in property grids, type converters, or other serialization scenarios. It is similar in purpose to the .NET built-in IParsable<T> introduced in .NET 7+, but can be used on earlier frameworks to maintain consistency across multiple target frameworks.

Examples

public class MyType : IParsable<MyType>
{
    public string Name { get; set; }
    
    public MyType Parse(string s, IFormatProvider? provider = null)
    {
        return new MyType { Name = s };
    }
}

See Also

⚠️ **GitHub.com Fallback** ⚠️