dependency.IsX()
). If the caller already takes this dependency, consider making the callee static, and passing the result of dependency.IsX()
as a parameter.
public class MyClass : IMyClass
{
private readonly IDependecy _dependency;
public MyClass(IDependecy dependency)
{
_dependency = dependency;
}
public void MyMethod()
{
// We passed in the entire dependency just to call one method on it.
if (_dependency.IsX())
{
// do something
}
else
{
// do something else
}
}
}
public static class MyClass
{
public static void MyMethod(bool isX)
{
if (isX)
{
// do something
}
else
{
// do something else
}
}
}
// then from the caller:
MyClass.MyMethod(_dependency.IsX());