Click here to Skip to main content
15,902,891 members
Home / Discussions / C#
   

C#

 
AnswerRe: Try Catch. Pin
X'Nork25-Aug-06 2:00
X'Nork25-Aug-06 2:00 
QuestionRe: Try Catch. Pin
_AK_25-Aug-06 2:04
_AK_25-Aug-06 2:04 
AnswerRe: Try Catch. Pin
X'Nork25-Aug-06 2:34
X'Nork25-Aug-06 2:34 
GeneralRe: Try Catch. Pin
_AK_25-Aug-06 2:42
_AK_25-Aug-06 2:42 
AnswerRe: Try Catch. Pin
Guffa25-Aug-06 2:12
Guffa25-Aug-06 2:12 
GeneralRe: Try Catch. Pin
Vipin Venugopal25-Aug-06 2:16
Vipin Venugopal25-Aug-06 2:16 
GeneralRe: Try Catch. Pin
Scott Dorman1-Sep-06 13:44
professionalScott Dorman1-Sep-06 13:44 
AnswerRe: Try Catch. Pin
Scott Dorman1-Sep-06 13:41
professionalScott Dorman1-Sep-06 13:41 
Using try/catch, try/finally, and try/catch/finally blocks are only expensive when an exception occurs. At that point, the runtime has to take a lot of steps to unwind all of the catch handlers to see who should respond to the exception.

Exceptions should only be thrown when something goes wrong, not to help control program flow. If you use them to try and control program flow, then it gets expensive (not to mention it's just bad practice).

Incidentally, if you have any using blocks

using (MemoryStream stream = new MemoryStream())
{
// do some work here
}

you are implicitly using a try/finally block. The C# compiler will automatically turn this into

MemoryStream stream = new MemoryStream();
try
{
// do some work here
}
finally
{
if (stream != null)
{
((IDisposable)stream).Dispose();
}
}

Questionhow to sum the values of a single windows form datagrid column Pin
choopie25-Aug-06 1:53
choopie25-Aug-06 1:53 
AnswerRe: how to sum the values of a single windows form datagrid column Pin
Itanium25-Aug-06 2:32
Itanium25-Aug-06 2:32 
GeneralRe: how to sum the values of a single windows form datagrid column Pin
choopie25-Aug-06 2:57
choopie25-Aug-06 2:57 
GeneralRe: how to sum the values of a single windows form datagrid column Pin
Itanium25-Aug-06 3:01
Itanium25-Aug-06 3:01 
QuestionAccess Control -> WindowsIdentity Pin
Goerlandt25-Aug-06 1:05
Goerlandt25-Aug-06 1:05 
AnswerRe: Access Control -> WindowsIdentity Pin
stancrm25-Aug-06 2:25
stancrm25-Aug-06 2:25 
QuestionHow to set read-only properties of Outlook.PostItem object? Pin
ziggy_125-Aug-06 0:55
ziggy_125-Aug-06 0:55 
QuestionA question abt master detail forms Pin
Rocky#25-Aug-06 0:48
Rocky#25-Aug-06 0:48 
AnswerRe: A question abt master detail forms Pin
Itanium25-Aug-06 2:28
Itanium25-Aug-06 2:28 
GeneralRe: A question abt master detail forms Pin
Rocky#25-Aug-06 20:54
Rocky#25-Aug-06 20:54 
QuestionC# Outlook add-in (MAPI) - queer PR_SENDER_NAME Pin
ziggy_125-Aug-06 0:42
ziggy_125-Aug-06 0:42 
QuestionHidden Fields Pin
Brendan Vogt25-Aug-06 0:27
Brendan Vogt25-Aug-06 0:27 
AnswerRe: Hidden Fields Pin
Shajeel25-Aug-06 0:41
Shajeel25-Aug-06 0:41 
GeneralRe: Hidden Fields Pin
Brendan Vogt25-Aug-06 0:55
Brendan Vogt25-Aug-06 0:55 
GeneralRe: Hidden Fields Pin
Shajeel25-Aug-06 1:16
Shajeel25-Aug-06 1:16 
AnswerRe: Hidden Fields Pin
Mircea Grelus25-Aug-06 1:07
Mircea Grelus25-Aug-06 1:07 
QuestionIs there any class or utility that reads the sln file Pin
Brosis25-Aug-06 0:04
Brosis25-Aug-06 0:04 

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.