Which would be considered more maintainable?
if (a == b) c = true; else c = false;
or
c = (a == b);
I've tried looking in Code Complete, but can't find an answer.
I think the first is more readable (you can literally read it out loud), which I also think makes it more maintainable. The second one certainly makes more sense and reduces code, but I'm not sure it's as maintainable for C# developers (I'd expect to see this idiom more in, for example, Python).
else c = falsefor the first or make the assignment an||=in the second. – delnan Nov 30 '12 at 21:31c = a==b ? true : false;– FrustratedWithFormsDesigner Nov 30 '12 at 22:13