Skip to content

Instantly share code, notes, and snippets.

@jamesmosier
Created October 28, 2014 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmosier/2426424a2344288dc079 to your computer and use it in GitHub Desktop.
Save jamesmosier/2426424a2344288dc079 to your computer and use it in GitHub Desktop.
Check for null or empty int
//To check for null int (if int is marked as nullable)
if (request.Tickets.Any(x => x.EventId == default(int?))) {}
//Otherwise to just check for "no" eventId which is zero
if (request.Tickets.Any(x => x.EventId == 0)) {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment