UrbanPro

Learn ASP.NET from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is difference between "throw" and "throw ex" in .Net?

Asked by Last Modified  

25 Answers

Learn ASP.NET

Follow 0
Answer

Please enter your answer

IT Course Training

Yes, there is a difference; 1) throw ex resets the stack trace (so your errors would appear to originate from HandleException) 2) throw doesn't - the original offender would be preserved.
Comments

Expert Microsoft Technology Trainer (SharePoint, Dot Net, MSBI, SQL Server)

In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e....
read more
In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e. 'throw ex' resets the stack trace read less
Comments

IT Professional Trainer with above 15 years of experience into software IT training

Using Throw statement you can either throw a system exception or your own custom exception
Comments

Training Centre

1.In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. 2. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace....
read more
1.In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. 2. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e. 'throw ex' resets the stack trace read less
Comments

Qa mentor | sdet | istqb® | csm® | sfc™ | perfecto automation certified | recommended on urbanpro

In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. Declaration of throw try { // do some operation that can fail } catch (Exception ex) { // do some local cleanup throw; } Throw...
read more
In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. Declaration of throw try { // do some operation that can fail } catch (Exception ex) { // do some local cleanup throw; } Throw ex In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e. 'throw ex' resets the stack trace. Declaration of throw ex try { // do some operation that can fail } catch (Exception ex) { // do some local cleanup throw ex; } } read less
Comments

I can try and give my best to the student

In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e....
read more
In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e. 'throw ex' resets the stack trace. - See more at: read less
Comments

Have 9+ years in teaching with 5 + years software development industries exp

throw re-throws the exception that was caught, and preserves the stack trace. throw ex throws the same exception, but resets the stack trace to that method.
Comments

7 yrs Experience along with Microsoft Certified Technology Specialist Trainer for .Net with C# as Language

throw re-throws the exception that was caught, and preserves the stack trace. throw ex throws the same exception, but resets the stack trace to that method. I hope you will remember the difference ..
Comments

B.Tech(C.S.)

If you use "throw" statement, it preserve original error stack information. If you use "throw ex" statement, stack trace of the exception will be replaced with a stack trace starting at the re-throw point.
Comments

Programming Faculty

In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e. 'throw...
read more
In Throw, the original exception stack trace will be retained. To keep the original stack trace information, the correct syntax is 'throw' without specifying an exception. In Throw ex, the original stack trace information will get override and you will lose the original exception stack trace. I.e. 'throw ex' resets the stack trace. read less
Comments

View 23 more Answers

Related Questions

What is the difference between asp.net and c#.net?
1.Csharp is best known as C#. 2.C# is a programming language used when developing Asp.net. 3.The C# programming language is specially designed for easy use in practically any purpose. 4.Asp.net...
Aadarsh
how will do custom sorting using div express controls in asp.net MVC
Using webgrid we can do custom sorting in MVC
Mallikarjuna
With many online free tutorials in place, does one ever need to hire a mentor to learn a new Technology? if yes, why? i am in the process of learning MVC, linq, and WCF and by far using online resources. if anyone out there is interested in learning, can join me. we can learn together.
definitely,you need to mentor .Because online courses doesn't train in the aspect of real time project experience.But a good trainer who works in a IT will have exposure to all the phases of development...
Ranganath
What is ASP.Net?
ASP.NET is an open source server-side Web application framework designed for Web development to produce dynamic Web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services.
Aadarsh
What is the difference between asp.net and vb.net?
asp.net is web technology that is used in building web applications and websites. Vb.net is language that is used in writing programs that are utilizing the asp.net framework Asp.net contains...
Aadarsh

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Read CSV data using ODBC Connection
Codes to read the CSV data using ODBC Connection- Input File: File's Encoding format should be ANSI as below class Student{ public string CollegeId { get; set; } public string AdmissionDate...

ASP.NET - Introduction
ASP.NET is a web development platform, which provides a programming model, a comprehensive software infrastructure and various services required to build up robust web applications for PC, as well as mobile...

Contents Of ASP.NET
Getting Started with ASP.NET This module explains how to build and configure a simple ASP.NET application. Lessons: Introduction to ASP.NET Web Applications Features of ASP.NET Configuring ASP.NET...

Service-Level Agreement (SLA) Definition
A service-level agreement (SLA) is a contract between a service provider and its internal or external customers that documents what services the provider will furnish. SLAs originated with network service...
M

Mohammad Shafi

0 0
0

Extension method In C#
Introduction. Hello Guys, In this article, I will explain what is extension method and why and where we should use this. Let’s understand the term extension means we are going to create something...

Looking for ASP.NET ?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for ASP.NET Classes?

The best tutors for ASP.NET Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn ASP.NET with the Best Tutors

The best Tutors for ASP.NET Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more