QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

Consolidate on either string.Empty or ""

Open Shane32 opened this issue 2 months ago • 1 comments

To a huge part a matter of taste, but using the literal "" has a few advantages over using string.Empty (in general, not specifi to this repo):

  • less IL code as the literal is a constant as opposed a field load -> smaller assembly
  • less work for the JIT, as no load and inlining of that field is needed

If a change is done, we should it do for the whole project to be consistent. If not, I'm also fine with it, as these two listed bullet don't change much here.

This is more a general note.

Originally posted by @gfoidl in https://github.com/Shane32/QRCoder/pull/622#discussion_r2404551096

Shane32 avatar Oct 05 '25 20:10 Shane32

In general, I'd like to follow .NET analysis rules. I'm not sure exactly what that means in this specific case, but one of my goals is to enable the analyzers at the recommended level. It might not be practical until we remove support for .NET Framework in v2...

Originally posted by @Shane32

Shane32 avatar Oct 05 '25 20:10 Shane32