✅ Converting value to nullable
I've got a point in my code where I've got:
I need to write
ChangeType
, and only have access to value
and type
. Using Convert.ChangeType()
doesn't work here, and throws an exception.
How can I convert this value to nullable successfully?
Thanks10 Replies
you can't
you can never have a boxed nullable
ahh shit...
okay
?
I don't know that it's int at that point
that just gets boxed as an int
I can re-work some other code further up the chain to make this work
if the Nullable has no value, when you box it, it gives you a literal null
I'm not sure what the goal here is
Windows10CE#8553
REPL Result: Success
Result: bool
Compile: 493.959ms | Execution: 36.655ms | React with ❌ to remove this embed.
If this isn't possible, then I've got another approach that I can try here
Thanks both