Implementing RAII in C#

前端 未结 4 1518
一整个雨季
一整个雨季 2021-01-18 00:47

I have an InfoPath form which I need to conditionally disable it\'s OnChange events. Since it\'s not possible to bind the event handlers after the form has loaded, I\'m forc

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-18 01:04

    To answer your two questions:

    1. No, there is not, Garbage Collection in .NET is not deterministic in nature
    2. No, you can not, the using clause gets translated into a try/finally block type of code, and in any case you cannot detect that it is constructed from any of those two constructs, compared to outside

提交回复
热议问题