Skip to content

Implement IFormattable on Option<T>#21

Open
atifaziz wants to merge 6 commits intonlkl:masterfrom
atifaziz:formattable
Open

Implement IFormattable on Option<T>#21
atifaziz wants to merge 6 commits intonlkl:masterfrom
atifaziz:formattable

Conversation

@atifaziz
Copy link
Contributor

This PR builds on top of #19 and addresses #20 to fully address the examples called out in #17.

The IFormattable implementation is explicit.

This renders Option<T>.ToString() consistent with Nullable<T>.ToString() and easier to substitute for.
Instead of hopping over another String.Format (and causing an
allocation of another format string), delegate to the underlying
implementation of IFormattable on the value if it exists, otherwise to
Option's own ToString().
@Clindbergh
Copy link

@nlkl Is there a reason this is not merged? Thank you.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants