Created
October 13, 2021 16:31
-
-
Save maximgorbatyuk/1a6590f82547772746f5d97121869c8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BusinessService | |
{ | |
private readonly ILogger _logger; | |
public BusinessService(ILogger logger) | |
{ | |
_logger = logger; | |
} | |
public void SomeMethod() | |
{ | |
_logger.Write("Hello world"); | |
} | |
} | |
var service = new BusinessService(new ConsoleLogger()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConsoleLogger : ILogger | |
{ | |
public void Write(string message) | |
{ | |
Console.WriteLine(message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ILogger | |
{ | |
void Write(string message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment