1
Answer

Nested If and Try statements?

Ask a question
Dan

Dan

16y
3.6k
1

Im a bit new to C# and the syntax so please forgive my ignorance. I have a dotnet page using a C# code behind file and in the C# code there is a try/catch statement with some nested IF/ELSE statements inside it. I need to perform another validation after the initial TRY but before all the IF/ELSE statements. Can you open another try clause before closing it with a catch? Here is an example, Is that syntax correct and can you nest TRY's?

TRY
{
   TRY{
      IF {
            blah;
            }
      ELSE {
            blah;
            }
      CATCH {
      stuff;
      
}
CATCH {
blah;
}
}


Answers (1)