Basically, it is used for logging purposes. Consider the Example of Web
application.
UI Will call the Database Layer.
If an exception occurs at database level, although the function will catch
the exception for logging purposes
but it will also throw it again so that it can be handled at UI (may be
custom error screen).
For Ex:
void GetDataset()
{
try
{
CallDatabase()
}
catch(SQLException)
{
Log It();
throw;
}
}
Hope this helps.
--
MAdhur
"Pure Heart" <Pu*******@discussions.microsoft.comwrote in message
news:E9**********************************@microsof t.com...
Hi
for me the throw statment is very confusing and un clear, i mean for
structured error handeling if the eception is not handeled it will search
for
handlers in the calling methods hirarchy so why we need to re throw the
exception to the calling method since it will be done autimatically by
.NET ?
whats the use of throw then ?
thank you
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643