Skip to content

Commit

Permalink
feat(83547): Simplification of "System.Text.Json.SourceGeneration.Jso…
Browse files Browse the repository at this point in the history
…nSourceGenerator.Emitter.FormatStringLiteral(string?)" implementation.
  • Loading branch information
Maksim Golev committed Oct 4, 2023
1 parent 67fb358 commit 51fcbb0
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1344,20 +1344,7 @@ private static string FormatJsonSerializerDefaults(JsonSerializerDefaults defaul

private static string FormatBool(bool value) => value ? "true" : "false";
private static string FormatStringLiteral(string? value)
{
string returnValue;

if (value is null)
{
returnValue = "null";
}
else
{
returnValue = SyntaxFactory.Literal(value).ToFullString();
}

return returnValue;
}
=> value is null ? "null" : SyntaxFactory.Literal(value).ToFullString();

/// <summary>
/// Method used to generate JsonTypeInfo given options instance
Expand Down

0 comments on commit 51fcbb0

Please sign in to comment.