✅ Two methods: struct and non-struct
Why does b.F(42) call the 2nd overload? 42 is a value-type which is what structs are?
6 Replies
because calling the first overload would require converting into a
Nullable<T>
(a.k.a. T?
when T
is a struct)
while the second overload does not require any conversion, so it is a closer matchThank you. If it did use the first one, would that involve boxing it?
no, it is not a boxing conversion
it is just a wrapper struct
struct Nullable<T> { T value; bool hasValue; }
which is blessed by the languagethank you @reflectronic
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered