I have two case:
-Use static service
public class TestService {
public static bool FunctionA(int b) {
return b > 0;
}
}
-Use interface
public interface ITestSerice {
bool FunctionA(int b);
}
public class TestService : ITestService {
public bool FunctionA(int b) {
return b > 0;
}
}
Static class is very simple. But I often see more people using the interface (or higher than Dependency Injection). Please explain to me why and when to use the interface? (which is better?)
Sorry if my english is too bad :D