You can't cast from string to int, but you can do a conversion. So you might want to do this:
int value = Convert.ToInt32("1234");
The blog article you link to does not talk about casting string to int. Rather, it talks about using the null coalescing operator. One way this can be used to deal with converting strings, would be to make a convert method returning int?
, then using null coalescing operator to provide the default value of choice. Then you would be able to say:
int value = SafeConvert.ToInt32(stringValue) ?? 1; // Assigned 1 if conversion fails.
This is one possible implementation of the SafeConvert.ToInt32 method:
public static int? ToInt32(string value)
{
int n;
if(!int.TryParse(value,out n))
return null;
return n;
}