How do you handle a null for a Max value in a linq to entities statement?
int UserLevelID = db.Characters.Where(o => o.UserId == UserID).Max(o => o.LevelID);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not quite sure what you mean when you say count, since you aren’t referring to count anywhere in that code. If you are wonding how to handle a null
o.LevelIDyou could do something like this:??is the coalesce operator in .NETUPDATE
Try this: