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

C#

 
AnswerRe: Catching several (hierarchically unrelated) exceptions in the same catch block Pin
#realJSOP10-Mar-10 0:07
professional#realJSOP10-Mar-10 0:07 
GeneralRe: Catching several (hierarchically unrelated) exceptions in the same catch block Pin
blackblizzard10-Mar-10 0:10
blackblizzard10-Mar-10 0:10 
AnswerRe: Catching several (hierarchically unrelated) exceptions in the same catch block Pin
Keith Barrow10-Mar-10 0:09
professionalKeith Barrow10-Mar-10 0:09 
GeneralRe: Catching several (hierarchically unrelated) exceptions in the same catch block Pin
blackblizzard10-Mar-10 0:12
blackblizzard10-Mar-10 0:12 
AnswerRe: [SOLVED] Catching several (hierarchically unrelated) exceptions in the same catch block Pin
AspDotNetDev10-Mar-10 12:47
protectorAspDotNetDev10-Mar-10 12:47 
GeneralRe: [SOLVED] Catching several (hierarchically unrelated) exceptions in the same catch block Pin
blackblizzard10-Mar-10 20:31
blackblizzard10-Mar-10 20:31 
GeneralRe: [SOLVED] Catching several (hierarchically unrelated) exceptions in the same catch block Pin
AspDotNetDev10-Mar-10 20:50
protectorAspDotNetDev10-Mar-10 20:50 
GeneralRe: [SOLVED] Catching several (hierarchically unrelated) exceptions in the same catch block Pin
blackblizzard10-Mar-10 21:10
blackblizzard10-Mar-10 21:10 
aspdotnetdev wrote:
Hmm, I thought C# complained when you let it fall through like that, but it seems the compiler only complains when you have something under the first case above and no "break". That is, it expects that all the logic be placed on the bottom-most of the cases you fall through. Good to know... thanks!


Sure! Smile | :)

aspdotnetdev wrote:
Not sure if that's true. I know Reflection.Emit and dynamically building types and things of that sort are expensive, but I'm not sure GetType is all that expensive, as it is pretty much known at compile time. As far as derived classes, that shouldn't be any more expensive than other inherited method call. Depends on how .NET implements GetType under the hood, but I tend to think it would use the faster technique. The string comparison done during the switch statement could slow things down marginally, but when you are dealing with exception cases, you typically don't need to worry about speed (assuming you are not using exceptions to control the typical flow of your program).


I read somewhere in the msdn site that although GetType and typeof are considerably less expensive than all other reflection methods they don't come particularly cheap (I'd post a link, but I haven't been able to find my reference). Although you're right that this is a case where an exception has been thrown, so we're not really concerned about performance.
GeneralRe: [SOLVED] Catching several (hierarchically unrelated) exceptions in the same catch block Pin
AspDotNetDev10-Mar-10 21:55
protectorAspDotNetDev10-Mar-10 21:55 
GeneralRe: [SOLVED] Catching several (hierarchically unrelated) exceptions in the same catch block Pin
blackblizzard10-Mar-10 22:00
blackblizzard10-Mar-10 22:00 
QuestionSending email and keeping a copy on the server Pin
eyalbi0079-Mar-10 22:53
eyalbi0079-Mar-10 22:53 
AnswerRe: Sending email and keeping a copy on the server Pin
Gerrit44410-Mar-10 0:07
Gerrit44410-Mar-10 0:07 
AnswerRe: Sending email and keeping a copy on the server Pin
DX Roster10-Mar-10 0:24
DX Roster10-Mar-10 0:24 
GeneralRe: Sending email and keeping a copy on the server Pin
Saksida Bojan10-Mar-10 5:42
Saksida Bojan10-Mar-10 5:42 
GeneralRe: Sending email and keeping a copy on the server Pin
eyalbi00714-Mar-10 0:18
eyalbi00714-Mar-10 0:18 
GeneralRe: Sending email and keeping a copy on the server Pin
Saksida Bojan14-Mar-10 2:04
Saksida Bojan14-Mar-10 2:04 
Questionaudio sound suite for .net crack Pin
Fatemi9-Mar-10 22:43
Fatemi9-Mar-10 22:43 
GeneralRe: audio sound suite for .net crack Pin
harold aptroot9-Mar-10 23:14
harold aptroot9-Mar-10 23:14 
GeneralRe: audio sound suite for .net crack Pin
Fatemi9-Mar-10 23:33
Fatemi9-Mar-10 23:33 
GeneralRe: audio sound suite for .net crack Pin
harold aptroot9-Mar-10 23:43
harold aptroot9-Mar-10 23:43 
GeneralRe: audio sound suite for .net crack Pin
The Man from U.N.C.L.E.9-Mar-10 23:47
The Man from U.N.C.L.E.9-Mar-10 23:47 
GeneralRe: audio sound suite for .net crack Pin
harold aptroot10-Mar-10 0:06
harold aptroot10-Mar-10 0:06 
GeneralRe: audio sound suite for .net crack Pin
#realJSOP10-Mar-10 1:44
professional#realJSOP10-Mar-10 1:44 
GeneralRe: audio sound suite for .net crack Pin
harold aptroot10-Mar-10 2:08
harold aptroot10-Mar-10 2:08 
GeneralRe: audio sound suite for .net crack PinPopular
OriginalGriff9-Mar-10 23:47
mveOriginalGriff9-Mar-10 23:47 

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.