Why does it not allowed to use try-catch statement without {} ?
- by alex
Why can't I use code like this ?
1
int i = 0;
try i = int.Parse("qwerty");
catch throw;
2
try i = int.Parse("qwerty");
catch;
finally Log.Write("error");
And should write like this
1
int i = 0;
try { i = int.Parse("qwerty"); } catch { throw; }
2
try { i = int.Parse("qwerty");}
catch {}
finally {Log.Write("error");}
PS:
I can use…