Can we throw exception from catch block ?
Answers were Sorted based on User's Feedback
Answer / nilesh
Yes. A throw statement can be used in the catch block to re-
throw the exception, which has been caught by the catch
statement. For example:
catch (InvalidCastException e)
{
throw (e); // Rethrowing exception e
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / arjun
The exceptions, which we caught inside a catch block, can
re-throw to a higher context by using the keyword throw
inside the catch block. The following program shows how to
do this.
//C#: Exception Handling: Handling all exceptions
using System;
class MyClass
{
public void Method()
{
try
{
int x = 0;
int sum = 100/x;
}
catch(DivideByZeroException e)
{
throw;
}
}
}
class MyClient
{
public static void Main()
{
MyClass mc = new MyClass();
try
{
mc.Method();
}
catch(Exception e)
{
Console.WriteLine("Exception caught here" );
}
Console.WriteLine("LAST STATEMENT");
}
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / vamshi krishna
Try
{
//Implemented code
}
catch(ex)
{
alert(ex.message)
}
| Is This Answer Correct ? | 1 Yes | 4 No |
What is the Global.asax used for?
What is the difference between application state and session state in asp net?
What are user controls and custom controls ?
Where on the Internet would you look for Web services?
5 Answers IBM, MNC, Siebel Systems,
which is the new version of IIS SERVER
Which control has default post back is enabled(true)?
0 Answers Sans Pareil IT Services,
How do you do exception management
where is declare global variable in asp.net and what is use of global variable
Describe the difference between inline and code behind - which is best in a loosely coupled solution Tightly coupled - INLINE
Tell about WebService in Asp.Net?
How do you declare delegates and are delegates and events one and the same and explain how do you declare delegates and invoke them ?
What is the difference between ldap and active directory?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)