Click here to Skip to main content
15,902,189 members

Comments by andres_fprado (Top 6 by date)

andres_fprado 7-May-19 22:55pm View    
This does not comply with the original question. The submitted program is expected to work with numbers up to 1000 digits long. Numbers that long can not be represented by any of the built-in numeric types (not even by decimal).
andres_fprado 9-Apr-16 1:18am View    
Try with:
<td>@(item.purpose == null) ? "" : (item.purpose.protype_purpose_name ?? "")</td>
andres_fprado 9-Apr-16 1:10am View    
Good luck! This is a little understood (and quite useful) operator in C#. I've used it in similar situations as the one you described. Hope it helps.
andres_fprado 9-Apr-16 1:05am View    
You could do that with:

<td>@item.prototypecategory.prototype_category_name ?? "no" </td>
andres_fprado 9-Apr-16 0:59am View    
No, you don't need the second <td></td> at all. You would just write:

<td>@item.prototypecategory.prototype_category_name ?? "" </td>

In Razor, the first <td> will always be emitted (written to the output). Then, the @ means to evaluate the C# expression and emit the result (which will be either the value of your variable, if not null, or an empty string otherwise). Finally, the closing </td> will always be emitted.

So, if the variable's value was "test", you would get <td>test</td>, and if it was null, you would simply get <td></td>.