C# code won't compile. No implicit conversion between null and int [duplicate]
Solution 1:
int? x = string.IsNullOrEmpty(cert) ? (int?)null : int.Parse(cert);
Solution 2:
I've come across the same thing ... I usually just cast the null to (int?)
int? x = (string.IsNullOrEmpty(cert)) ? (int?)null: int.Parse(cert);