When Visual Studio greys out some code and tells you it is redundant, does this mean the compiler will ignore this code or will it still compile this code? In other words, would this redundant code never be interpreted or will it be? Or does it simply act as a reminder that the code is simply not required?
If I leave redundant code in my classes/structs etc, will it have an impact on performance?
Thanks
If the code is redundant it’s not necessary for compilation, but leaving it in won’t have any impact on performance.
As the compiler has identified the code as redundant in Visual Studio it won’t get compiled into the IL or machine code.
It’s not good practice to leave redundant code in your project. If you need the code in the future you should get it from the older versions of the file in your source code repository.