Click here to Skip to main content
15,906,567 members
Home / Discussions / C#
   

C#

 
GeneralRe: uncaught exception handlers Pin
Derek Bartram30-Apr-08 1:49
Derek Bartram30-Apr-08 1:49 
GeneralRe: uncaught exception handlers Pin
George_George30-Apr-08 3:58
George_George30-Apr-08 3:58 
GeneralRe: uncaught exception handlers Pin
Derek Bartram30-Apr-08 4:54
Derek Bartram30-Apr-08 4:54 
GeneralRe: uncaught exception handlers Pin
George_George30-Apr-08 5:08
George_George30-Apr-08 5:08 
GeneralRe: uncaught exception handlers Pin
PIEBALDconsult27-Apr-08 4:37
mvePIEBALDconsult27-Apr-08 4:37 
GeneralRe: uncaught exception handlers Pin
Derek Bartram27-Apr-08 6:56
Derek Bartram27-Apr-08 6:56 
GeneralRe: uncaught exception handlers Pin
George_George27-Apr-08 20:17
George_George27-Apr-08 20:17 
GeneralRe: uncaught exception handlers Pin
Derek Bartram30-Apr-08 5:08
Derek Bartram30-Apr-08 5:08 
Firstly, from above

//writer is a stream writer to a file..
try
{
writer.Write("Hello");
}
catch (Exception err)
{
//handle error
}

In this case you couldn't test for every possible error as some are far out the scope of plausible; e.g. can't access the file as it was on a removable drive that was just unplugged.



George_George wrote:
"not controlling programming flow"?


//slider is a silder whos value is 0 to 100
double y = 100.0 / slider.Value

then

try
{
double y = 100.0 / slider.Value
}
catch (Exception)
{
//handler exception
}

is a bad way to write this code (remembing slider.Value could be 0 causing divide by 0 exception), a better way would be....

if (slider.Value != 0)
{
double y = 100.0 / slider.Value
}
else
{
handle error
}



George_George wrote:
What do you mean "didn't specify 'massive' which didn't help"


It's all very well saying massive improvement or whatever, but if you don't give some quantative value or referance, massive has no meaning (it could save 0.1ms which in terms of clock cycle is alot, but probably less significant to compared to a complex if statement).
GeneralRe: uncaught exception handlers Pin
George_George30-Apr-08 5:11
George_George30-Apr-08 5:11 
GeneralRe: uncaught exception handlers Pin
Derek Bartram30-Apr-08 5:48
Derek Bartram30-Apr-08 5:48 
GeneralRe: uncaught exception handlers Pin
George_George1-May-08 2:13
George_George1-May-08 2:13 
GeneralRe: uncaught exception handlers Pin
Derek Bartram1-May-08 2:20
Derek Bartram1-May-08 2:20 
GeneralRe: uncaught exception handlers Pin
George_George1-May-08 2:45
George_George1-May-08 2:45 
GeneralRe: uncaught exception handlers Pin
George_George27-Apr-08 19:56
George_George27-Apr-08 19:56 
GeneralRe: uncaught exception handlers Pin
George_George26-Apr-08 21:06
George_George26-Apr-08 21:06 
GeneralRe: uncaught exception handlers Pin
N a v a n e e t h26-Apr-08 6:15
N a v a n e e t h26-Apr-08 6:15 
GeneralRe: uncaught exception handlers Pin
George_George26-Apr-08 21:04
George_George26-Apr-08 21:04 
GeneralRe: uncaught exception handlers Pin
N a v a n e e t h27-Apr-08 19:49
N a v a n e e t h27-Apr-08 19:49 
GeneralRe: uncaught exception handlers Pin
George_George27-Apr-08 19:55
George_George27-Apr-08 19:55 
GeneralRe: uncaught exception handlers Pin
N a v a n e e t h27-Apr-08 22:38
N a v a n e e t h27-Apr-08 22:38 
GeneralRe: uncaught exception handlers Pin
George_George28-Apr-08 1:20
George_George28-Apr-08 1:20 
GeneralRe: uncaught exception handlers Pin
N a v a n e e t h28-Apr-08 19:49
N a v a n e e t h28-Apr-08 19:49 
GeneralRe: uncaught exception handlers Pin
George_George29-Apr-08 2:25
George_George29-Apr-08 2:25 
GeneralRe: uncaught exception handlers Pin
N a v a n e e t h29-Apr-08 3:45
N a v a n e e t h29-Apr-08 3:45 
GeneralRe: uncaught exception handlers Pin
George_George29-Apr-08 4:21
George_George29-Apr-08 4:21 

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.