You can compile it in Release mode to enable optimization. Alternatively, you can run ngen.exe to generate your own DLL files that will not carry the JIT overhead.
However, keep in mind that all of these measures and tools are not a silver bullet for poorly written code (not to mention what you have). You should profile your application and see if you can improvise the execution time of any code, as well as learn slower paths (and strive to improve them).
To protect it, use a good obfuscator such as (Salamander, SmartAssembly, etc.). It will not be completely indistinguishable, but it will make it much more difficult.
To absolutely protect it, enter the code in C ++! You can compile it with the /clr option, which will make them immune to reflection and disassembly.
source share