ToInt

public static int ToInt(this string current)
{
	int convertedValue;
	
	int.TryParse(current, out convertedValue);

	return convertedValue;
}
Example:
var someString = "5";
var someInt = someString.ToInt();

Description

tries to parse a string to an int, returns zero if it is unable to parse

Details

Double click on the code to select all.

 

;