public static int? StringToNullInt(this string value) { if (string.IsNullOrEmpty(value)) return null; int outValue; bool isValid = int.TryParse(value, out outValue); return outValue; }