By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

try catch stuff

P: n/a
ari
hey all,

i know i need a try catch in my method but do i put all the contents of my
method withing the try catch or should I just put some of the code?
thanks,
ari
Feb 11 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
>i know i need a try catch in my method but do i put all the contents of my
method withing the try catch or should I just put some of the code?


It depends on the purpose of catching the exception. Why do you need
the Try Catch block to begin with?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Feb 11 '06 #2

P: n/a

if you need all code in the try statement ?? this depends on the code my
initial feeling would say include only the strict necessary code in it

only use try catch blocks if you really need to do so

try catch blocks have a lot of overhead and so make your program a lot
slower

it is better coding practice to check for yourself if possible
regards

Michel Posseth [MCP]


"ari" <ar*@discussions.microsoft.com> schreef in bericht
news:42**********************************@microsof t.com...
hey all,

i know i need a try catch in my method but do i put all the contents of my
method withing the try catch or should I just put some of the code?
thanks,
ari

Feb 12 '06 #3

P: n/a
ari
thanks everyone.

"ari" wrote:
hey all,

i know i need a try catch in my method but do i put all the contents of my
method withing the try catch or should I just put some of the code?
thanks,
ari

Feb 14 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.