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
Post a Comment