C#C
C#12mo ago
Core

Static class or regular class with interface?

Hello,
I've been building a QR code generator for a while. It's a simple method call QrCodeGenerator.Generate("data", options).

c#
var qrCode = QrCodeGenerator.Generate("data", new QrCodeOptions
{
    MarkerLeft = new MarkerOptions
    {
        OuterStyle = markerStyle,
        InnerStyle = markerStyle
    },
    MarkerRight = new MarkerOptions
    {
        OuterStyle = markerStyle,
        InnerStyle = markerStyle
    },
    MarkerBottom = new MarkerOptions
    {
        OuterStyle = markerStyle,
        InnerStyle = markerStyle
    },
    PatternStyle = PatternStyle.Circle,
    Format = ImageFormat.Png,
});


It is a static method/class, I was wondering if it would be better to supply the class trough an interface, making it available trough DI. Suppose it's going to be a nuget package, would it make a difference if it was supplied trough DI, instead of a static class?
Was this page helpful?