Click here to Skip to main content
15,881,248 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL with C# Pin
Not Active25-Sep-09 4:42
mentorNot Active25-Sep-09 4:42 
GeneralRe: SQL with C# Pin
EliottA25-Sep-09 4:43
EliottA25-Sep-09 4:43 
QuestionHow to automatically scroll text up in a richtext box. Pin
Sophronis Mantoles25-Sep-09 3:02
Sophronis Mantoles25-Sep-09 3:02 
AnswerRe: How to automatically scroll text up in a richtext box. Pin
Calla25-Sep-09 3:22
Calla25-Sep-09 3:22 
GeneralRe: How to automatically scroll text up in a richtext box. [modified] Pin
Sophronis Mantoles25-Sep-09 4:51
Sophronis Mantoles25-Sep-09 4:51 
AnswerRe: How to automatically scroll text up in a richtext box. Pin
Alan N25-Sep-09 3:24
Alan N25-Sep-09 3:24 
AnswerRe: How to automatically scroll text up in a richtext box. Pin
Henry Minute25-Sep-09 3:27
Henry Minute25-Sep-09 3:27 
QuestionWhich one is better, forcing an enabled=true at each call or check it with an if statement? Pin
Anıl Yıldız25-Sep-09 3:01
Anıl Yıldız25-Sep-09 3:01 
Hello,

In a professional view, which one of the below does the least cycling?

Assume these two lines of code in a button's click event and i want blabla control's enabled property to be set true at the click of the button:

1) blabla.Enabled=true;

2) if(!blabla.Enabled) blabla.Enabled=true;

First one will force an Enabled=true at every button click even if it was already true. (Or maybe there is a logic beneath that I don't know, like the framework checks it and does the work, in this case, the question is irrelevant)

Second one will first check if it is false and then set true. This one will not always run the code but instead it will do an IF check.

So the question again, is: Which one is better for CPU? (Or in another sentence: Does IF or Enabled property uses more cycle?)

Thanks in advance.

Best regards,
Anıl Yıldız.
AnswerRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
freakyit25-Sep-09 4:07
freakyit25-Sep-09 4:07 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
Anıl Yıldız25-Sep-09 4:18
Anıl Yıldız25-Sep-09 4:18 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
PIEBALDconsult25-Sep-09 5:32
mvePIEBALDconsult25-Sep-09 5:32 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
freakyit25-Sep-09 7:00
freakyit25-Sep-09 7:00 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
PIEBALDconsult25-Sep-09 7:10
mvePIEBALDconsult25-Sep-09 7:10 
AnswerRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
PIEBALDconsult25-Sep-09 5:06
mvePIEBALDconsult25-Sep-09 5:06 
AnswerRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
PIEBALDconsult25-Sep-09 6:51
mvePIEBALDconsult25-Sep-09 6:51 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
Anıl Yıldız25-Sep-09 7:02
Anıl Yıldız25-Sep-09 7:02 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
freakyit25-Sep-09 7:07
freakyit25-Sep-09 7:07 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
freakyit25-Sep-09 7:05
freakyit25-Sep-09 7:05 
GeneralRe: Which one is better, forcing an enabled=true at each call or check it with an if statement? Pin
PIEBALDconsult25-Sep-09 7:20
mvePIEBALDconsult25-Sep-09 7:20 
QuestionProblems with ID Automation Pin
Qendro25-Sep-09 2:40
Qendro25-Sep-09 2:40 
GeneralRe: Problems with ID Automation Pin
musefan25-Sep-09 2:56
musefan25-Sep-09 2:56 
GeneralRe: Problems with ID Automation Pin
Qendro25-Sep-09 3:04
Qendro25-Sep-09 3:04 
QuestionPrinting multiple font sizes on the same page... Pin
jameschristianii25-Sep-09 2:37
jameschristianii25-Sep-09 2:37 
AnswerRe: Printing multiple font sizes on the same page... Pin
musefan25-Sep-09 2:54
musefan25-Sep-09 2:54 
GeneralRe: Printing multiple font sizes on the same page... Pin
jameschristianii25-Sep-09 3:07
jameschristianii25-Sep-09 3:07 

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.