Skip to content

Instantly share code, notes, and snippets.

@Scooletz
Created February 2, 2018 21:17
Show Gist options
  • Save Scooletz/272a87bc3f948b3041e49409d78125ee to your computer and use it in GitHub Desktop.
Save Scooletz/272a87bc3f948b3041e49409d78125ee to your computer and use it in GitHub Desktop.
JSON.NET serializers Guid
public override void WriteValue(Guid value)
{
InternalWriteValue(JsonToken.String);
string text = null;
#if HAVE_CHAR_TO_STRING_WITH_CULTURE
text = value.ToString("D", CultureInfo.InvariantCulture);
#else
text = value.ToString("D");
#endif
_writer.Write(_quoteChar);
_writer.Write(text);
_writer.Write(_quoteChar);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment