Deconstruct Extension Method ignored when type already has Deconstruction method(s). #9837
Unanswered
obiwanjacobi
asked this question in
Q&A
Replies: 2 comments 1 reply
-
|
When using extension methods the extension method needs to be marked with |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
See: #1092 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I always thought that picking the Deconstruction method was done by using it's parameter types. However I recently ran into a problem that seems to indicate otherwise.
Concreet: I wanted an extra
Deconstructmethod onDateTime. MyDeconstructmethod has unique parameter types, so there can be no mistakes/ambiguity. However, as I set out to write my unit test, the compiler insisted on using the nativeDataTime.Deconstruct(withintparams) and not my version.Years,MonthsandDaysare my custom types, all declared asreadonly record struct:I even tried to use the
OverloadResolutionPriorityAttributebut that didn't fix it.Q:
Deconstructmethod is detected?Beta Was this translation helpful? Give feedback.
All reactions