QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

Disposable objects and README

Open netotz opened this issue 4 years ago • 1 comments

Type of

[ ] Bug
[x] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

I'm using the package as follows:

using var qrGenerator = new QRCodeGenerator();
using var qrData = qrGenerator.CreateQrCode(textToEncode, ECCLevel.H);
using var qrCode = new Base64QRCode(qrData);

return qrCode.GetGraphic(100);

with using for each class given that they implement IDisposable, and also using the var keyword.

Current Behavior

The examples in both the README file and the Wiki section don't use using so I wonder if that's the best use case, and if not then why do the classes implement IDisposable. Also I think the documentation should be updated to use var keywords.

Possible Solution

Update documentation in README and Wiki with using and var. Current code samples could still be there in case somebody is using the package with a very old .NET version that doesn't support them. I'm willing to make a PR for this :)

netotz avatar May 07 '21 19:05 netotz

There's no specific reason, why the using statements aren't part of the documentation. The documentation just wasn't updated in this particular aspect. So feel free to send in a PR.

codebude avatar May 10 '21 07:05 codebude