private object ChangeType(object value, Type t)
{
if (t == typeof(bool) && value is string)
{
string s = value.ToString().ToLower(CultureInfo.InvariantCulture);
if (s == "yes" || s == "true") return true;
if (s == "no" || s == "false") return false;
throw new FormatException(String.Format(Resources.InvalidValueForBoolean, value));
}
else
return Convert.ChangeType(value, t, CultureInfo.CurrentCulture);
}