C# Compiler optimization – Unused methods

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.

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

Leave a Comment