Skip to content

Implement As on Option directly to avoid misguided use of As extension method#77

Merged
ax0l0tl merged 3 commits intomainfrom
feature/AsCapturedOnOption
Dec 12, 2025
Merged

Implement As on Option directly to avoid misguided use of As extension method#77
ax0l0tl merged 3 commits intomainfrom
feature/AsCapturedOnOption

Conversation

@ax0l0tl
Copy link
Member

@ax0l0tl ax0l0tl commented Dec 9, 2025

No description provided.

@park-jasper
Copy link
Member

Should OptionExtension.As<TTarget>(this object item) then be removed?

@ax0l0tl
Copy link
Member Author

ax0l0tl commented Dec 10, 2025

Should OptionExtension.As<TTarget>(this object item) then be removed?

No, it's still totally valid to write x.As<B>() if you expect x to be of type B. The mistake that sometimes happened was that I wrote Option<BDerived> x = ...; var y = x.As<B>(); which returned None, what was unexpected.

@ax0l0tl ax0l0tl merged commit 0f61f90 into main Dec 12, 2025
2 checks passed
@park-jasper park-jasper deleted the feature/AsCapturedOnOption branch December 15, 2025 12:31
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.

3 participants