Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Last active Aug 8, 2022
Embed
What would you like to do?
using System;
using System.IO;
namespace CsharpSingleResponsibilityPrinciple
{
class UserSRP
{
private FileLogger logger = new FileLogger();
public void Add(Database db)
{
try {
db.Add();
}
catch (Exception ex)
{
logger.Handle(ex.ToString());
}
}
}
internal class Logger
{
public void Handle(string error)
{
File.WriteAllText(@"C:\something\Error.txt", error);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment