internal static bool TryConvertToString(object value, Type type, out string s) { #if HAVE_TYPE_DESCRIPTOR if (JsonTypeReflector.CanTypeDescriptorConvertString(type, out TypeConverter converter)) { s = converter.ConvertToInvariantString(value); return(true); } #endif #if (DOTNET || PORTABLE) if (value is Guid || value is Uri || value is TimeSpan) { s = value.ToString(); return(true); } #endif type = value as Type; if (type != null) { s = type.AssemblyQualifiedName; return(true); } s = null; return(false); }