How to insert CIL code to C#

前端 未结 5 2040
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-01 17:55

Is it possible to insert IL code to C# method?

5条回答
  •  梦如初夏
    2021-02-01 18:20

    DynamicMethod is the lightweight way to accomplish this at runtime.

    The Microsoft C# compiler doesn't support injection of IL at compile-time, but a code-weaving tool could do so as a post-compile step.

提交回复
热议问题