ToInt
tries to parse a string to an int, returns zero if it is unable to parse
Source
public static int ToInt(this string current)
{
int convertedValue;
int.TryParse(current, out convertedValue);
return convertedValue;
}
Example
var someString = "5";
var someInt = someString.ToInt();