C# convert to ternary expression

how to convert to ternary expression?

if (SortOrder == "ASC")
            {
                SortOrder = "ASC";
            }
            else
            {
                SortOrder = "DESC";
            }
conrad2010Asked:
Who is Participating?
 
p_davisConnect With a Mentor Commented:
SortOrder = (SortOrder == "ASC" ? "ASC" : "DESC");

I hope this isn't homework
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.