There is no way to stop anybody from decompilation
You can use obfuscator to change the names of variables, methods or classes to make your code less understandable.
As per msdn.
As for protection, there are a number of different schemes that
customers have told me about.
- No protection. Some companies sell products that either ship with source code or have source code that can be bought separately, or have
chosen not to protect certain parts of their application that have
little IP.
- Some companies use the obfuscator that ships with VS 7.1 (a “Community Edition“ of PreEmptive Solution's Dotfuscator)
- Some companies use one of the commercial obfuscators out there. There's a list on the C# Developer Center on MSDN.
- Some companies write the sensitive parts of their code in C++, compile that to an unmanaged DLL, and then use interop to call into
the unmanaged DLL.