Reputation: 1970
I have the following expression which can be an empty string in some cases
@item.Creator
And I tried to represent it as follows in Razor View page but it is not giving me what I expect. This is how I wrote the code
@item.Creator ?? Unknown
Expecting that in cases where the Creator is an empty string that I would get "Unknown" in its place. However, on the contrary, I get the following:
?? Unknown
in the page as output. I am obviously missing something on how to apply this operator in Razor View and I will appreciate any guide to correct it.
I am working with ASP.NET-Core 3.1 on C# 8 on a windows machine thank you
Upvotes: 2
Views: 1668