Gotcha: use parentheses around ternary op conditional expressions

Έχουν δημοσιευτεί 25 Αυγούστου 18 03:42 μμ | Μπιρμπίλης Γεώργιος 
Just came across the following case in C# that puzzled me momentarily, especially since the strings involved were long enough and the expression was broken on multiple lines: bool flag = true; string test1 = flag? "xa" : "xb"; string test2 = "x" + (flag? "a" : "b"); string test3 = "x" + flag? "a" […]
Δημοσίευση στην κατηγορία: , , , , , , , ,

Σχόλια:

Χωρίς Σχόλια
Έχει απενεργοποιηθεί η προσθήκη σχολίων από ανώνυμα μέλη

About Μπιρμπίλης Γεώργιος

Microsoft MVP J# 2004-2010 Borland Spirit of Delphi 2001 http://zoomicon.com

Search

Go

Ιστορικό Δημοσιεύσεων

Συνδρομές