© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•14mo ago•
24 replies
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)
QrCodeGenerator.Generate("data", options)
.

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,
});
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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Create dynamic class that implements interface with static properties
C#CC# / help
3y ago
✅ Use static class or DI?
C#CC# / help
3y ago
❔ static class
C#CC# / help
3y ago