且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C# 编译器优化 - 未使用的方法

更新时间:2023-11-10 16:25:46

刚刚签入了带有发布版本的反射器.编译器不会删除未使用的私有方法.

Just checked in reflector with a release build. The compiler doesn't remove the unused private methods.

有很多方法可以在没有编译器知识的情况下使用方法,例如反射.所以编译器不会尝试猜测.它只是将方法留在那里.

There are ways to use a method without the compiler knowledge, like with reflection. So the compiler doesn't try to guess. It just leaves the methods there.

编译器删除的唯一私有方法是部分方法,没有实施.

The only private methods the compiler removes are partial methods without implementation.

对于 C# 编译器优化,请查看 此处 (archive.org).

For the C# compiler optimizations, look here (archive.org).