Linked Questions

70 votes
5 answers
26k views

Possible Duplicate: difference between throw and throw new Exception() What would be the point of just having catch (Exception) { throw; } What does this do?
CJ7's user avatar
  • 23.4k
7 votes
4 answers
2k views

Possible Duplicate: difference between throw and throw new Exception() I'm a programmer working on adding new functionality to legacy code. While debugging, I parsed over this Catch block, which ...
Raven Dreamer's user avatar
0 votes
4 answers
180 views

Given the following statements: try { ... some code ... } catch { ... some cleanup code ... throw; } and try { ... some code ... } catch (Exception ex) { ... some cleanup code ......
Scottie's user avatar
  • 11.4k
566 votes
13 answers
304k views

There are some posts that asks what the difference between those two are already. (why do I have to even mention this...) But my question is different in a way that I am calling "throw ex" in another ...
dance2die's user avatar
  • 37.2k
312 votes
11 answers
197k views

What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a ...
Seibar's user avatar
  • 70.6k
42 votes
6 answers
18k views

Consider: try { // Some code here } catch (IOException e) { throw e; } catch (Exception e) { throw e; } What is the difference between throw e and throw new Exception(e)? try { // ...
Vinaya Nayak's user avatar
  • 1,311
36 votes
6 answers
12k views

I have this code try { //AN EXCEPTION IS GENERATED HERE!!! } catch { SqlService.RollbackTransaction(); throw; } Code above is called in this code try { //HERE IS CALLED THE METHOD THAT ...
Claudio Redi's user avatar
  • 68.6k
2 votes
2 answers
8k views

Im trying to get a simple SQL statement in my code, and get a DataTable, and for some reason I get this weird exception : Invalid column name This is my code : public DataTable GetAllVideoID(...
thormayer's user avatar
  • 1,070
3 votes
1 answer
3k views

I have next code public async Task<IEnumerable<MyTabel>> GetData() { try { var dbCtx = new myEntities(); return await dbCtx....
a3code's user avatar
  • 14.1k
3 votes
3 answers
5k views

I have exception handling code in every method for the below code for the bottom level methods throw new Exception("The error that happens"); Is there any way I can avoid writing this code again and ...
priya's user avatar
  • 33
0 votes
4 answers
2k views

I wrote a program that connects to MS Access. When I fill in the fields and add a new item to Access the program fails. The exception is "Syntax error in INSERT INTO statement" Here is the relevant ...
user454563's user avatar
0 votes
3 answers
2k views

I have an asynchronous method that consumes a Web API action. It appears to be stuck in a loop. My reasoning for this is because if I put a break point on line 1 of the catch block, and step into, it ...
MattSull's user avatar
  • 5,564
1 vote
2 answers
7k views

Let's say I have a 3-tier ASP.NET application written in C#. How are you supposed to utilize the DAL, BLL and PL correctly? For example let's say I have a stored procedure which requires a parameter ...
PriceCheaperton's user avatar
0 votes
2 answers
2k views

I've been digging around the past couple hours on how to implement simple save/load functionality to a game i'm making. The save data is being stored in a text file, during the game the player can ...
Lee Brindley's user avatar
  • 6,532
0 votes
1 answer
6k views

This is Unity C# //... public static void Interupt(int Index, string Text){ try{ Change(Transforms[ Index ], Text); } catch{ throw new System....
MilitaryG's user avatar

15 30 50 per page