开发者

How to find out the current overflow-checking context?

开发者 https://www.devze.com 2022-12-30 19:49 出处:网络
Is there a way to do this in C#? So for example, if your method is called and you wa开发者_运维知识库nt to know if the caller had put the method call inside a checked block?checked/ unchecked blocks

Is there a way to do this in C#?

So for example, if your method is called and you wa开发者_运维知识库nt to know if the caller had put the method call inside a checked block?


checked/ unchecked blocks are always local to the method. The keywords influence how IL is generated for the statements and expressions in the block. It doesn't propagate to methods called, and there is no way to determine at run-time if a method was called from such a block. It's a compile-time feature.

0

精彩评论

暂无评论...
验证码 换一张
取 消