C# null coalescing operator returning null

前端 未结 6 2353
小鲜肉
小鲜肉 2021-02-14 10:44

Recently my co-worker showed me a block of code that was not working correctly:

public class SomeClass
{
    private IList _categories;

    publ         


        
6条回答
  •  时光取名叫无心
    2021-02-14 11:22

    This could happen because you have optimizations turned on - in that case the assignment may be delayed for as long as the compiler can demonstrate that doing so doesn't change the result. Of course, this looks weird in the debugger, but it's perfectly OK.

提交回复
热议问题