Consider the following code that I use when displaying a client’s email address inside a table in a view:
<%: Customer.MailingAddress == null ? "" : Customer.MailingAddress.City %>
I believe that I use quite a lot of these ternary conditional statements, and I wonder if there is a way to return to an object that evaluates so that I can use it in the expression. Something like this is possible:
<%: Customer.MailingAddress == null ? "" : {0}.City %>
Is there something similar? I know that I can create a variable to store the value, but it would be nice to save everything inside one hard little operator on the watch pages.
Thank!
source
share