Inline "If" like function for strings in C#

Hello Experts,

My c# knowledge stinks.  I'm trying to recall a function where I could state something like the following:

txtlevel.text = if(mystring = "1", truepart, falsePart);

If you could help me recall what this is I'd really appreciate it.

Thanks
LVL 3
eshurakAsked:
Who is Participating?
 
effesCommented:
txtlevel.text = mystring == "1" ? truepart : falsePart;

Open in new window

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.