wasAsked.

Explain any one SOLID principle.

PwC · Role not specified · technical

Published

Asked in 2026 · C#

Community answers

Posted by wasAsked editorial collection

The Single Responsibility Principle says a module should have one reason to change. It does not mean every class must contain one method; unrelated policies should not be coupled. Example: public sealed class InvoiceService( IInvoiceRepository repository, IInvoiceRenderer renderer, IEmailSender email) { public async Task SendAsync(Guid id, CancellationToken ct) { var invoice = await repository.GetAsync(id, ct); var document = renderer.Render(invoice); await email.SendAsync(invoice.CustomerEmail, document, ct); } } Persistence, rendering, and transport can change independently. Do not split cohesive domain rules into tiny classes mechanically; the goal is safer change, not maximum file count.

Backbencher Developer · · 0 likes

Sign in to add your answer

Related interview topics