Click here to Skip to main content
15,921,276 members
Home / Discussions / C#
   

C#

 
AnswerRe: i am from greece and i want to write a file in greeks with data` from a textbox Pin
Pedram Behroozi17-Nov-08 8:38
Pedram Behroozi17-Nov-08 8:38 
GeneralRe: i am from greece and i want to write a file in greeks with data` from a textbox Pin
dianikol17-Nov-08 11:39
dianikol17-Nov-08 11:39 
GeneralRe: i am from greece and i want to write a file in greeks with data` from a textbox Pin
Pedram Behroozi17-Nov-08 19:42
Pedram Behroozi17-Nov-08 19:42 
Questionhow to make long time whit ConnectionTimeout Pin
E_Gold17-Nov-08 7:18
E_Gold17-Nov-08 7:18 
AnswerRe: how to make long time whit ConnectionTimeout Pin
Wendelius17-Nov-08 7:22
mentorWendelius17-Nov-08 7:22 
AnswerRe: how to make long time whit ConnectionTimeout Pin
PavanPareta17-Nov-08 19:11
PavanPareta17-Nov-08 19:11 
QuestionAll rows are not comming in dataset while filling from Excel.(when different datatype in excel column) Pin
ManojKumar1917-Nov-08 6:43
ManojKumar1917-Nov-08 6:43 
AnswerRe: All rows are not comming in dataset while filling from Excel.(when different datatype in excel column) Pin
leppie17-Nov-08 20:24
leppie17-Nov-08 20:24 
GeneralRe: All rows are not comming in dataset while filling from Excel.(when different datatype in excel column) Pin
ManojKumar1918-Nov-08 4:52
ManojKumar1918-Nov-08 4:52 
Questiona problem of multiple forms Pin
Seraph_summer17-Nov-08 5:18
Seraph_summer17-Nov-08 5:18 
AnswerRe: a problem of multiple forms Pin
Ennis Ray Lynch, Jr.17-Nov-08 5:35
Ennis Ray Lynch, Jr.17-Nov-08 5:35 
QuestionCase select versus IF Statement Pin
EliottA17-Nov-08 4:59
EliottA17-Nov-08 4:59 
AnswerRe: Case select versus IF Statement Pin
Ennis Ray Lynch, Jr.17-Nov-08 5:03
Ennis Ray Lynch, Jr.17-Nov-08 5:03 
AnswerRe: Case select versus IF Statement Pin
#realJSOP17-Nov-08 6:04
professional#realJSOP17-Nov-08 6:04 
GeneralRe: Case select versus IF Statement Pin
EliottA17-Nov-08 6:12
EliottA17-Nov-08 6:12 
GeneralRe: Case select versus IF Statement Pin
#realJSOP17-Nov-08 6:31
professional#realJSOP17-Nov-08 6:31 
GeneralRe: Case select versus IF Statement Pin
Robert.C.Cartaino17-Nov-08 6:54
Robert.C.Cartaino17-Nov-08 6:54 
EliottA wrote:
So there is no actual efficiency when using a select case over a bunch of if statements?


In your situation, there is no "actual efficiency" in terms of performance using if statements vs using switch statements. If your deepest loops are taking 2 seconds to execute, switching from if to switch may improve your execution time by the tiniest fraction of a millisecond.

But that's besides the point. Unless you absolutely need to shave milliseconds off your code, decisions about how your code is organized should be about readability and communicating your intent to future readers of the code. Don't prematurely optimize.

That aside, there is more opportunity for a compiler to optimize long switch statements than with a series of if statements. The compiler will typically convert if statements into a series of compare-and-jump operations. Switch statements (in C#) can be implemented using techniques like jump tables (when comparing ints) or hash tables (when comparing strings) to increase code efficiency. But we're talking about real low-level, behind-the-scenes stuff that the average developer will likely never have to consider in real-world applications.

Enjoy,
Robert C. Cartaino
AnswerRe: Case select versus IF Statement Pin
Guffa17-Nov-08 6:29
Guffa17-Nov-08 6:29 
GeneralRe: Case select versus IF Statement Pin
#realJSOP17-Nov-08 11:03
professional#realJSOP17-Nov-08 11:03 
GeneralRe: Case select versus IF Statement Pin
Guffa17-Nov-08 13:09
Guffa17-Nov-08 13:09 
GeneralRe: Case select versus IF Statement Pin
Luc Pattyn17-Nov-08 15:29
sitebuilderLuc Pattyn17-Nov-08 15:29 
QuestionWhat is this friggin .config file? Pin
Dewald17-Nov-08 4:34
Dewald17-Nov-08 4:34 
AnswerRe: What is this friggin .config file? Pin
led mike17-Nov-08 4:46
led mike17-Nov-08 4:46 
GeneralRe: What is this friggin .config file? Pin
Dewald17-Nov-08 21:05
Dewald17-Nov-08 21:05 
GeneralRe: What is this friggin .config file? Pin
led mike18-Nov-08 6:05
led mike18-Nov-08 6:05 

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.