Sharing code using Service Classes in C#
Briefly

Dependency Injection complicates using static methods in C#, as seen in scenarios requiring an HttpClient, which can't be easily passed in static context.
The challenge arises when refactoring code to validate emails without exposing implementation details, forcing dependency injection into method signatures.
Switching from static methods to service classes like EmailValidationService facilitates better dependency management while keeping method signatures clean and reusable.
By adopting service classes, we can maintain clean code architecture while still leveraging Dependency Injection without exposing internal dependencies to consumers.
Read at CodeProject
[
|
]