Skip to content

Commit cb5a497

Browse files
committed
Update ifdef
1 parent 554c527 commit cb5a497

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

QRCoder/QRCodeGenerator.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,8 @@ private static BitArray PlainTextToBinaryByte(string plainText, EciMode eciMode,
935935
}
936936
}
937937

938-
#if NETCOREAPP2_1_OR_GREATER
938+
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1
939939
// We can use stackalloc for small arrays to prevent heap allocations
940-
// (also available in .NET Standard and .NET Framework with an additional NuGet dependency)
941940
// Note that all QR codes should fit within 3000 bytes, so this code should never trigger a heap allocation unless an exception will be thrown anyway.
942941
int count = targetEncoding.GetByteCount(plainText);
943942
Span<byte> codeBytes = count < 3000 ? stackalloc byte[count] : new byte[count];
@@ -971,7 +970,7 @@ private static BitArray PlainTextToBinaryByte(string plainText, EciMode eciMode,
971970
/// <param name="prefixZeros">The number of leading zeros to prepend to the resulting BitArray.</param>
972971
/// <returns>A BitArray representing the bits of the input byteArray, with optional leading zeros.</returns>
973972
private static BitArray ToBitArray(
974-
#if NET5_0_OR_GREATER
973+
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1
975974
ReadOnlySpan<byte> byteArray, // byte[] has an implicit cast to ReadOnlySpan<byte>
976975
#else
977976
byte[] byteArray,

0 commit comments

Comments
 (0)