Check out example codes for "c# max sequence contains no elements". It will help you in understanding the concepts better.
Code Example 1
return collection.Any() ? collection.Max(c => c.Value) : 0;
// Or replace 0 with null or whatever other default
// value you'd like to return.
Learn ReactJs, React Native from akashmittal.com