I would like to override bool
's TryParse
method to accept "yes" and "no." I know the method I want to use (below) but I don't know how to override bool
's method.
... bool TryParse(string value, out bool result)
{
if (value == "yes")
{
result = true;
return true;
}
else if (value == "no")
{
result = false;
return true;
}
else
{
return bool.TryParse(value, result);
}
}