Skip to content

Should Optional implement IConvertable? #72

@dresswithpockets

Description

@dresswithpockets

I'm looking for Convert support in Optional, for use in Reflection, like:

Convert.ChangeType(value, type);

where value is of some type and type might be typeof(Option<T>), but it could be something else that implements IConvertable.

This would depend on Option<T> implementing IConvertable. I can make a PR for the inclusion of this functionality in the API.

I think it would make more sense to implement this for Conversion support rather than doing something else in reflection like adding a custom case in my own project's code for if the type is of Convert<> and then calling Convert.Some<T>(value).

Is this within the scope of Option? Is there an argument to be made as to why it shouldn't be apart of the API? Is there an alternative way to implement this, or maybe something in the Optional API that offers casting between T and Option<T> through reflection?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions