public static object ConvertValue(object value, Type expectedType) { if (value == null) return null; if (expectedType.IsInstanceOfType(value)) return value; return ConvertValueString(value.ToString(), expectedType); }