Skip to content

Commit 51fcbb0

Browse files
author
Maksim Golev
committed
feat(83547): Simplification of "System.Text.Json.SourceGeneration.JsonSourceGenerator.Emitter.FormatStringLiteral(string?)" implementation.
1 parent 67fb358 commit 51fcbb0

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs

+1-14
Original file line numberDiff line numberDiff line change
@@ -1344,20 +1344,7 @@ private static string FormatJsonSerializerDefaults(JsonSerializerDefaults defaul
13441344

13451345
private static string FormatBool(bool value) => value ? "true" : "false";
13461346
private static string FormatStringLiteral(string? value)
1347-
{
1348-
string returnValue;
1349-
1350-
if (value is null)
1351-
{
1352-
returnValue = "null";
1353-
}
1354-
else
1355-
{
1356-
returnValue = SyntaxFactory.Literal(value).ToFullString();
1357-
}
1358-
1359-
return returnValue;
1360-
}
1347+
=> value is null ? "null" : SyntaxFactory.Literal(value).ToFullString();
13611348

13621349
/// <summary>
13631350
/// Method used to generate JsonTypeInfo given options instance

0 commit comments

Comments
 (0)