Skip to content

Commit 1ff8038

Browse files
Nikolay Mitikovmitikov
authored andcommitted
CSHARP-2456: Use explicit function instead of anonymous.
Update src/MongoDB.Bson/IO/JsonWriter.cs Co-Authored-By: mitikov <[email protected]>
1 parent f63daea commit 1ff8038

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/MongoDB.Bson/IO/JsonWriter.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ protected override void Dispose(bool disposing)
814814
// private methods
815815
private string EscapedString(string value)
816816
{
817-
if (value.All(c => !NeedsEscaping(c)))
817+
if (!NeedsEscaping(value))
818818
{
819819
return value;
820820
}
@@ -935,7 +935,20 @@ private string GuidToString(BsonBinarySubType subType, byte[] bytes, GuidReprese
935935
}
936936
}
937937

938-
private static bool NeedsEscaping(char c)
938+
private bool NeedsEscaping(string text)
939+
{
940+
foreach (var letter in text)
941+
{
942+
if (NeedsEscaping(letter))
943+
{
944+
return true;
945+
}
946+
}
947+
948+
return false;
949+
}
950+
951+
private bool NeedsEscaping(char c)
939952
{
940953
switch (c)
941954
{

0 commit comments

Comments
 (0)