I have this code:
public int GetIntSetting(Settings setting, int nullState)
{
var s = GetStringSetting(setting);
if (string.IsNullOrEmpty(s))
return nullState;
return int.Parse(s);
}
If the value of s
is something like 1.234 then the functions creates an exception.
How can I make it so that if the value of s
has a decimal point then the function returns 0?