Why is unused code an issue? Doesn t the compiler get rid of unused code?
Why should you worry about unused code? After all, if it never gets called, what s the problem? In many cases, unused code actually points to a programming error. The issue is not that the code doesn t get called. The issue is that the code may contain important logic for your application, and the fact that it isn t called represents an error. For example, look at the following code: Dim Continue As Boolean = False If Continue Then ‘ Be sure to close database connections DatabaseConn.Close() End If In this example, the code in the If block is considered unused code. In this case, a potentially large bug is hidden by unused code.