Null check for razor in line text display

/ Published in: C#
Save to your folder(s)

This is far from ground breaking but I forget it all the time so thought this might be a useful place to keep a reference of it

Copy this code and paste it in your HTML
  1. @(Model.Roles == null ? "No" : Model.Roles.Count.ToString())

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.