Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: My opinion on languages is such Pin
wout de zeeuw17-Jul-06 22:42
wout de zeeuw17-Jul-06 22:42 
AnswerRe: Can anyone think of any disadvantage of using a params parameter? Pin
leppie17-Jul-06 22:15
leppie17-Jul-06 22:15 
GeneralRe: Can anyone think of any disadvantage of using a params parameter? Pin
wout de zeeuw17-Jul-06 22:41
wout de zeeuw17-Jul-06 22:41 
GeneralRe: Can anyone think of any disadvantage of using a params parameter? Pin
leppie17-Jul-06 22:52
leppie17-Jul-06 22:52 
GeneralRe: Can anyone think of any disadvantage of using a params parameter? Pin
wout de zeeuw17-Jul-06 23:08
wout de zeeuw17-Jul-06 23:08 
QuestionWhen do use validator and/or try...throw statement. Pin
Skanless17-Jul-06 11:22
Skanless17-Jul-06 11:22 
AnswerRe: When do use validator and/or try...throw statement. Pin
leckey17-Jul-06 11:41
leckey17-Jul-06 11:41 
AnswerRe: When do use validator and/or try...throw statement. Pin
Nader Elshehabi17-Jul-06 11:55
Nader Elshehabi17-Jul-06 11:55 
Hello

Exceptions were neatly described by a known programmer as "Expecting the unexpected" -unfortunately I don't seem to remember his name at the moment-.
The more your code is advanced or complicated, or doing hardware related tasks for example, the more error brone your code gets. Sometimes you write a long method to calculate some value, and in the middle you find yourself dividing by zero- for example-. Or accessing an access denied resource, unexpectedly deleted file, wrong or unavailable adress, etc...

Examples of exceptions are by far more than what a simple post can count. There are literallt thousands of cases in which you can benefit from putting your code in a try block. Yet that will be at the cost of excuting time. The more try block, the slower your program gets. While a simple validation methods only handles the user input.

The throw statement is appropriate when you want to put the error handling on the shoulder of a lower method in the call stack. ie. You don't want to handle the code in the current method, instead throw it back to the calling code.

To summerize:
Validation is concerned mainly with user input, to save the time that would be consumed by exception catching. While in other situation when you don't know what might go wrong -yet sometimes you might expect, or have a kind of an idea-, then it would be wise to put your code in a try block to prevent your program from crashing.

RegardsRose | [Rose]
GeneralRe: When do use validator and/or try...throw statement. Pin
Skanless17-Jul-06 12:51
Skanless17-Jul-06 12:51 
QuestionClient/Server App. Event Notification Pin
Ing. Pedro Fernandez17-Jul-06 10:14
Ing. Pedro Fernandez17-Jul-06 10:14 
AnswerUse Webservices Pin
Ennis Ray Lynch, Jr.17-Jul-06 10:24
Ennis Ray Lynch, Jr.17-Jul-06 10:24 
AnswerRe: Client/Server App. Event Notification Pin
led mike17-Jul-06 19:11
led mike17-Jul-06 19:11 
QuestionDevelope a telephone system in c# Pin
ystar17-Jul-06 10:11
ystar17-Jul-06 10:11 
AnswerTAPI Pin
Ennis Ray Lynch, Jr.17-Jul-06 10:23
Ennis Ray Lynch, Jr.17-Jul-06 10:23 
AnswerRe: Develope a telephone system in c# Pin
ystar17-Jul-06 10:34
ystar17-Jul-06 10:34 
GeneralRe: Develope a telephone system in c# Pin
Dave Kreskowiak17-Jul-06 12:12
mveDave Kreskowiak17-Jul-06 12:12 
AnswerRe: Develope a telephone system in c# Pin
Divyang Mithaiwala17-Jul-06 18:23
Divyang Mithaiwala17-Jul-06 18:23 
QuestionProblem accessing an object Pin
Goalie3517-Jul-06 9:04
Goalie3517-Jul-06 9:04 
AnswerRe: Problem accessing an object Pin
Josh Smith17-Jul-06 9:07
Josh Smith17-Jul-06 9:07 
GeneralRe: Problem accessing an object Pin
Goalie3517-Jul-06 9:15
Goalie3517-Jul-06 9:15 
GeneralRe: Problem accessing an object Pin
Josh Smith17-Jul-06 9:27
Josh Smith17-Jul-06 9:27 
AnswerRe: Problem accessing an object Pin
Wesley Samuel17-Jul-06 20:52
Wesley Samuel17-Jul-06 20:52 
QuestionPictureBox problem Pin
_tasleem17-Jul-06 6:31
_tasleem17-Jul-06 6:31 
AnswerRe: PictureBox problem Pin
Dave Kreskowiak17-Jul-06 6:54
mveDave Kreskowiak17-Jul-06 6:54 
GeneralRe: PictureBox problem Pin
Paul Conrad17-Jul-06 7:57
professionalPaul Conrad17-Jul-06 7:57 

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.