Understanding the null coalescing operator (??)

前端 未结 2 1713
攒了一身酷
攒了一身酷 2020-12-19 03:28

I have a custom WebControl which implements a .Value getter/setter returning a Nullable

It\'s a client-side filtered textbox

2条回答
  •  無奈伤痛
    2020-12-19 04:14

    (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?

提交回复
热议问题