You can stop static analysis, for example, by encrypting strings and decrypting them at run time in SecureString .
The SecureString class is specifically designed to prevent things such as passwords from being discovered in memory.
However, note that you can still attach the debugger to your process and see the lines, so you will also need to confuse the use of something like Dotfuscator to make it even harder to see sensitive lines.
Here is an article about some issues with SecureString .
Despite my shortcomings, I believe that this is still the best.
source share