The code is found here...
http://www.pobox.com/~skeet/csharp/exceptions.html
Willy.
"Alvin Bruney - ASP.NET MVP" <
www.lulu.com/owc> wrote in message
| Post some code Willy, I'm not taking your word for it. We all remember
this
| thread by the way.
|
| --
| Warm Regards,
| Alvin Bruney [MVP ASP.NET]
|
| [Shameless Author plug]
| The Microsoft Office Web Components Black Book with .NET
| Now Available @
www.lulu.com/owc
| Professional VSTO 2005 - Wrox/Wiley 2006
| Blog:
http://msmvps.com/blogs/Alvin/
| -------------------------------------------------------
|
|
|
| | > Jon,
| >
| > Note that Exceptions are significantly more expensive in V2, as shown
| here:
| >
| > V1.1
| > Total time taken: 00:00:32.2768033
| > Exceptions per millisecond: 154
| >
| > V2
| > Total time taken: 00:02:59.3157696
| > Exceptions per millisecond: 27
| >
| > that means 37 µsecs. per exception, I would say this is more expensive
as
| > some people think ;-)
| >
| > Willy.
| >
| >
| > | > | > It would also be far more expensive. Exceptions are very expensive
| and
| > | > really, exceptions are for "exceptional" events, things that you
| > normally
| > | > would not have control over.
| > |
| > | Exceptions aren't nearly as expensive as most people think. See
| > |
http://www.pobox.com/~skeet/csharp/exceptions.html
| > | (In this particular case the performance penalty could be significant
| > | in many programs, but I don't want you follow the myth of exception
| > | performance

| > |
| > | However, they're still wrong in this situation, because it really
isn't
| > | exceptional for a character not to be present in a string - it's
| > | something which is almost always a possibility when you use IndexOf,
in
| > | my experience. It's rarely an error condition which would make you
want
| > | to unwind the stack a significant distance.
| > |
| > | Of course, if Gordon wants to write his own method which throws an
| > | exception instead of returning -1, there's nothing to stop him -
| > | whereas if the method already threw an exception, wrapping it in a
| > | method which returned -1 would incur the performance penalty of the
| > | exception.
| > |
| > | --
| > | Jon Skeet - <
[email protected]>
| > |
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
| > | If replying to the group, please do not mail me too
| >
| >
|
|