Einzelnen Beitrag anzeigen

Benutzerbild von DP News-Robot
DP News-Robot

Registriert seit: 4. Jun 2010
14.963 Beiträge
 
#1

c# – Why does Try-Catch require curly braces – Stack Overflow

  Alt 27. Dez 2017, 05:12
From my SO Question Archive: Just curious: Why is the syntax for try catch in C# (Java also?) hard coded for multiple statements? Why doesn’t the language allow: int i; string s = DateTime.Now.Seconds % 2 == 1 ? "1" : "not 1"; try i = int.Parse(s); catch i = 0; The example is for trivial ...

More...
  Mit Zitat antworten Zitat