Created
October 28, 2014 19:16
-
-
Save jamesmosier/2426424a2344288dc079 to your computer and use it in GitHub Desktop.
Check for null or empty int
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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