Skip to content

Commit 767c10c

Browse files
committed
Simplify QR code generation logic
Refactored the QR code generation in `Program.cs` by using a static method `GenerateQrCode` on `QRCodeGenerator`, which eliminates the need for separate `QRCodeGenerator` and `QRCodeData` instances. This change reduces code complexity and improves performance by removing unnecessary object instantiation.
1 parent 343900a commit 767c10c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

TwoFactorAuthenticationSample/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@
137137
Label = user.Email
138138
};
139139

140-
using var qrCodeGenerator = new QRCodeGenerator();
141-
using var qrCodeData = qrCodeGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.Q);
140+
using var qrCodeData = QRCodeGenerator.GenerateQrCode(payload, QRCodeGenerator.ECCLevel.Q);
142141
using var qrCode = new PngByteQRCode(qrCodeData);
143142

144143
var qrCodeBytes = qrCode.GetGraphic(3);

0 commit comments

Comments
 (0)