If all code is written in a try block and write a catch
block with Exception type Exception .In that scenario will
all the exceptions catched by that catch block? or any
exceptions which will not be caught?
Answers were Sorted based on User's Feedback
Answer / parmjit
Yes all the exceptions will be catched by this catch block.
Because all the thrown exception as derived from this class
or it's sub class.
Because even if any exception occured which is not derived
from the Exception class, it is automatically wrapped in
RuntimeWrappedException which is a derived class of
Exception class.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / pompana gouda
Yes and No is the answer...
Yes because, Any type of exception will be caught by general
catch block.
No because,
If there are 3 lines which generate 3 different exceptions,
Then only first exception is caught in the general exception
catch block. If first line is not throwing exception then
whatever the line which throws exception will be caught...
Not all exceptions are handled by single catch statement.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / vinay tiwari
if we use some piece of code that return in different
language then there may be exception that are not define in
exception class to catch these type of exception we use
general catch handler
for exe
try
{
........
}
catch
{
..........
} //catch block without parameter is called general catch
handler
| Is This Answer Correct ? | 0 Yes | 1 No |
What does void do in c#?
What is Wrapper class in dot net?
Wht executescaler method is used?
What are the ways in which client can create object on server in cao model?
Is c# good for games?
What is dictionary collection in c#?
Does C# supports multi-dimensional arrays?
What's the difference between WindowsDefaultLocation and WindowsDefaultBounds?
How is a loop recorder monitored?
Which is the best way for keeping the data in XML or SQL server..and why?
What is a .aspx file?
What is jit? What are the different types of jit?
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)