The example I gave is a part of an old Autoit program, that uses Sqlite and have no need for secure code.
Removing unused methods in C# is unnecessary yes, but not the strip comments and rename part (for me that is).
I know what Autoit is, been using it for 15+ years and would had continued to do so if it wasn't for those damn scriptkidds who have used Autoit for virus/malware/cryptoware etc. thous making the av-vendors flag almost every program written in Autoit as virus.
And Autoit is just as C# released (can be anyway) in exe format, and both can (C# even more easy) be decompiled to plain source code.
As I said I have already tried to use lots of different obfuscate tools, and non of them worked with my codes .
But a simple renaming would (should), sins the code won't be "scrambled" just "trimmed".
If I compile a library, and throw the dll into dotpeek I have my entire source code with comments and all, and that's what I'm trying to prevent .
If I could get my library to work with one of those obfuscators, it would be perfect but for some reason unknown to me I can't .
Nope I'm not trying to prevent decompiling, if I could though that would be cool - but with those protection softwares I have tried, de4dot decompiles them all just fine.
I'm only trying to make my code less readable.
But after reading the answer from OriginalGriff I think that I might have used the obfuscator wrong, so I tried once more, and instead of protecting my dll's for them self before they was included into my program, I did it on the whole release, and that worked.
the strip comments and rename part (for me that is).
As OriginalGriff already told you, that is a waste of time, since you will not be sending the source code to the people who use your code. I assume this is your first step into working with a compiled language, so you need to understand the difference between source and object code. You are welcome to remove all the comments from your source before compiling it, but that will make no difference to the final executable, since comments are not carried over.
That's not strictly true - it's picking up the comments and such from the PDB file, which it detects from the App GUID (IIRC). Try this: create a new project, comment it, and build it.
copy the Release EXE to a safe place, and delete the original solution folder (as if it was just installed on a new machine).
Open the exe with dotPeek, and it can't find the PDB, so it uses just what's in the file. No comments!
As for readability, use an obfuscator and it should be pretty horrible to look at!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
The comments never make it into the code. BUT, if you decompile the executable on the machine that has the project still on it, you'll the the comments from the original source, not from the decompiled executable.