Any case where `TError` can't be boxed in example?
So I have the following:
But am getting an error on last line passing
null
in, I can see it resolves if i add a class
constraint to the generic arg, or if i give default
, but confused why it cant infer that TError?
is always gonna be boxed, i.e. if i had int
as TError
surely it can work out Nullable<int>
from TError?
5 Replies
@pride century 젠젠 Sorry for ping but im actually still confused :TERROR:
I get what you were saying about the
.Value
stuff
But how does this build fine with unconstrained type
I.e. this would crash surely for int?
i dont know what you mean by boxing here
sorry term for another lang
Nullable<int>
is boxed int
altho is actually wrong if Nullable<T>
is also a value-type, i just meant a nullable value type with itthats just a nullable value type
and honestly dont put too much thought into it
thats just how it works
just make the fields unnullable and cope with it
:TERROR:
ty anyways