var number = null;
int result = number.GetValueOrDefault();
Suppose text = null
OR
suppose text = ""
String.IsNullOrEmpty(text) ? 0 : int.Parse(text); // it will return zero
use the about line to get the desire value to want in place of null or empty