• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

C# convert to ternary expression

how to convert to ternary expression?

if (SortOrder == "ASC")
            {
                SortOrder = "ASC";
            }
            else
            {
                SortOrder = "DESC";
            }
0
conrad2010
Asked:
conrad2010
1 Solution
 
p_davisCommented:
SortOrder = (SortOrder == "ASC" ? "ASC" : "DESC");

I hope this isn't homework
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now