Click here to Skip to main content
15,887,453 members
Home / Discussions / C#
   

C#

 
AnswerRe: Asp.net Pin
OriginalGriff22-Jan-20 2:29
mveOriginalGriff22-Jan-20 2:29 
AnswerRe: Asp.net Pin
Richard Deeming22-Jan-20 3:11
mveRichard Deeming22-Jan-20 3:11 
AnswerRe: Asp.net Pin
Gerry Schmitz22-Jan-20 7:37
mveGerry Schmitz22-Jan-20 7:37 
QuestionConvert the data intered by the user to integer number Pin
Member 906313820-Jan-20 22:37
Member 906313820-Jan-20 22:37 
AnswerRe: Convert the data intered by the user to integer number Pin
OriginalGriff20-Jan-20 22:47
mveOriginalGriff20-Jan-20 22:47 
AnswerRe: Convert the data intered by the user to integer number Pin
ZurdoDev21-Jan-20 3:09
professionalZurdoDev21-Jan-20 3:09 
QuestionClear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 0:49
Lupu5R3x18-Jan-20 0:49 
AnswerRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 1:45
mveOriginalGriff18-Jan-20 1:45 
Before you even start removing comments, learn what is safe code and what isn't. Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.

When you concatenate strings, you cause problems because SQL receives commands like:
SQL
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood'
The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SQL
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable;--'
Which SQL sees as three separate commands:
SQL
SELECT * FROM MyTable WHERE StreetAddress = 'x';
A perfectly valid SELECT
SQL
DROP TABLE MyTable;
A perfectly valid "delete the table" command
SQL
--'
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.

So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?

Then, you need to know that what you are doing - stripping out comments, unused methods and so on - is a bad idea in C#, and unnecessary.
Autoit is a scripting language, so when you release it to users you send them the "source code", so making it hard to follow is - kinda - an advantage. But C# is compiled, which means that what gets released is not in source, not "human readable" - it's an EXE file, and that's binary code. So taking out comments is pointless as they don't go into the release material anyway!

C# EXE files can be reworked to produce "source code" that isn't identical to the input, but can be close: so if that is a problem for you, then look for what is called an Obfuscator - it's a tool that makes the code you can get from an EXE file much, much harder to read than your "stripper" can do.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 4:17
Lupu5R3x18-Jan-20 4:17 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 4:43
mveDave Kreskowiak18-Jan-20 4:43 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 6:51
Lupu5R3x18-Jan-20 6:51 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Richard MacCutchan18-Jan-20 4:52
mveRichard MacCutchan18-Jan-20 4:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 6:53
Lupu5R3x18-Jan-20 6:53 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 4:52
mveOriginalGriff18-Jan-20 4:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 6:57
Lupu5R3x18-Jan-20 6:57 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 7:01
mveOriginalGriff18-Jan-20 7:01 
AnswerRe: Clear comments and rename var/method names at compile time Pin
Gerry Schmitz18-Jan-20 7:00
mveGerry Schmitz18-Jan-20 7:00 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:09
Lupu5R3x18-Jan-20 7:09 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 16:03
mveDave Kreskowiak18-Jan-20 16:03 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Gerry Schmitz18-Jan-20 17:30
mveGerry Schmitz18-Jan-20 17:30 
Questioncompare two dictionary and display difference Pin
mjbaquiran18-Jan-20 0:01
mjbaquiran18-Jan-20 0:01 
QuestionRe: compare two dictionay and display difference Pin
Eddy Vluggen18-Jan-20 0:30
professionalEddy Vluggen18-Jan-20 0:30 
AnswerRe: compare two dictionay and display difference Pin
mjbaquiran18-Jan-20 7:05
mjbaquiran18-Jan-20 7:05 
AnswerRe: compare two dictionay and display difference Pin
Gerry Schmitz18-Jan-20 6:40
mveGerry Schmitz18-Jan-20 6:40 
GeneralRe: compare two dictionay and display difference Pin
mjbaquiran18-Jan-20 7:08
mjbaquiran18-Jan-20 7:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.