Check out example codes for "c# conditional format string". It will help you in understanding the concepts better.

Code Example 1

string formatString = items.Count > 0 ? "Items: {0}; Values: {1}" : "Values: {1}";
return string.Format(formatString, itemList, valueList);

Learn ReactJs, React Native from akashmittal.com