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

C#

 
GeneralRe: Close Windows Form automatically Pin
Judah Gabriel Himango2-Dec-04 7:34
sponsorJudah Gabriel Himango2-Dec-04 7:34 
GeneralRe: Close Windows Form automatically Pin
Heath Stewart2-Dec-04 7:40
protectorHeath Stewart2-Dec-04 7:40 
GeneralChange text color on a single line Pin
Gywox2-Dec-04 5:45
Gywox2-Dec-04 5:45 
GeneralTest for file lock Pin
Marc Clifton2-Dec-04 5:16
mvaMarc Clifton2-Dec-04 5:16 
GeneralRe: Test for file lock Pin
Heath Stewart2-Dec-04 5:31
protectorHeath Stewart2-Dec-04 5:31 
GeneralRe: Test for file lock Pin
Marc Clifton2-Dec-04 6:04
mvaMarc Clifton2-Dec-04 6:04 
GeneralRe: Test for file lock Pin
Heath Stewart2-Dec-04 7:34
protectorHeath Stewart2-Dec-04 7:34 
GeneralRe: Test for file lock Pin
Willie Lassiter5-Dec-04 17:55
Willie Lassiter5-Dec-04 17:55 
I hate to (cough) agree with Marc, but he's right. There no way an exception should be thrown when you can anticipate the failure of a method call beforehand. Exceptions are better thrown when a caller passes a NULL pointer or some other incorrect parameter value to a method when he shouldn't have; that's something you don't expect; that's something you don't know how to deal with; that's something you don't have an error value for; that's when you throw an exception.

Exceptions are for non-recoverable program failures. Proper error-handling is anticipating that a file you're trying to open may not exist; that should not be the cause of an exception.

Seems to me if the framework is going to provide file locking, it needs to provide a test method that does more than just test to see if the file is locked; it should be able to test, lock the file and open it all in one call, because between the return of the test and any attempt to open the file, someone else may beat you to the it, causing you to get the very exception you're trying to avoid by calling the test.

Marc's (cough) correct, as Microsoft has a bad design and implementation, and should fix the problem.

Also, there is no difference in all of the possible errors you can from win32 and the abundance of exceptions you can get from .NET. Exceptions as used today are little more than typed "goto" statements masquerading as objects, deluding people into believing they have OO error management.

When you force a developer to accept exceptions, you're telling him his program is going to run slower so all of the junior programmers using the language can write code that doesn't do proper failure testing, or instead put error-handling code in an else-statement that appears nowhere near the if-statement that tested the condition that failed. A good portion of exception code and logic entanglements (got that word from Marc) can be corrected by correcting the use of if-statements. Namely, don't handle errors in an else clause.

GeneralConverting string to bitmap Pin
jawbrey2-Dec-04 5:15
jawbrey2-Dec-04 5:15 
GeneralRe: Converting string to bitmap Pin
Heath Stewart2-Dec-04 7:17
protectorHeath Stewart2-Dec-04 7:17 
GeneralBrowse all controls Pin
bouli2-Dec-04 4:34
bouli2-Dec-04 4:34 
GeneralRe: Browse all controls Pin
Judah Gabriel Himango2-Dec-04 4:58
sponsorJudah Gabriel Himango2-Dec-04 4:58 
GeneralRe: Browse all controls Pin
bouli2-Dec-04 5:02
bouli2-Dec-04 5:02 
GeneralRe: Browse all controls Pin
Heath Stewart2-Dec-04 5:20
protectorHeath Stewart2-Dec-04 5:20 
GeneralRe: Browse all controls Pin
bouli2-Dec-04 5:30
bouli2-Dec-04 5:30 
GeneralRe: Browse all controls Pin
Heath Stewart2-Dec-04 5:35
protectorHeath Stewart2-Dec-04 5:35 
GeneralRe: Browse all controls Pin
Judah Gabriel Himango2-Dec-04 5:37
sponsorJudah Gabriel Himango2-Dec-04 5:37 
GeneralRe: Browse all controls Pin
Heath Stewart2-Dec-04 7:30
protectorHeath Stewart2-Dec-04 7:30 
GeneralRe: Browse all controls Pin
turbochimp2-Dec-04 5:08
turbochimp2-Dec-04 5:08 
GeneralProblem with string literals Pin
pchak2-Dec-04 4:18
pchak2-Dec-04 4:18 
GeneralRe: Problem with string literals Pin
turbochimp2-Dec-04 4:50
turbochimp2-Dec-04 4:50 
GeneralRe: Problem with string literals Pin
pchak2-Dec-04 5:30
pchak2-Dec-04 5:30 
Generalconnection path for database Pin
steve_rm2-Dec-04 4:18
steve_rm2-Dec-04 4:18 
GeneralRe: connection path for database Pin
turbochimp2-Dec-04 4:35
turbochimp2-Dec-04 4:35 
GeneralRe: connection path for database Pin
steve_rm2-Dec-04 5:20
steve_rm2-Dec-04 5:20 

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.