refactoring - How would you simplify this c# statement? -


i know there has simpler way of writing expression. not able figure out how however.

if (order != null) {     name += " " + order + extension; } else {     name += extension; } 

any suggestions appreciated.

you use ? operator:

name+= (order == null) ? extension : " " + order + extension; 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -