I have a custom WebControl
which implements a .Value
getter/setter returning a Nullable
It\'s a client-side filtered textbox
Take a look at this similar question
using coalescing null operator on nullable types changes implicit type
why not just do
decimal amount = uxTaxAmount.Value.HasValue ? uxTaxAmount.Value.Value : 0M
This isn't the right answer to the original posters problems given recent edits and comments.
(This answer was constructed from my comments above.)
Are you sure the debugger dsiplays this correctly to you? Have you tried stepping some lines further down to make sure you have the updated value of amount3
?
I'm sure it's just an issue with the debugger. Sometimes you have to step a little further. Maybe the translated code (IL) has some optimizations that confuse the debugger (or what would I know). But without the debugger, the value will be updated exactly when you expect it.
I've seen other experienced developers being confused by similar situations, so I know the debugger sometimes is "one line of code" behind when looking at an assignment to a local variable. Maybe someone can find a link discussing that?