Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,19 @@ public static void ValidateInt32MaxArrayLength(uint length)
}
}

public static bool AllBitsEqual(this BitArray bitArray, bool value)
#if !NET8_0_OR_GREATER
public static bool HasAllSet(this BitArray bitArray)
{
// Optimize this when https://github.com/dotnet/runtime/issues/72999 is fixed
for (int i = 0; i < bitArray.Count; i++)
{
if (bitArray[i] != value)
if (!bitArray[i])
{
return false;
}
}

return true;
}
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ internal void ValidateAllRequiredPropertiesAreRead(JsonTypeInfo typeInfo)
{
Debug.Assert(RequiredPropertiesSet != null);

if (!RequiredPropertiesSet.AllBitsEqual(true))
if (!RequiredPropertiesSet.HasAllSet())
{
ThrowHelper.ThrowJsonException_JsonRequiredPropertyMissing(typeInfo, RequiredPropertiesSet);
}
Expand Down