I used method 3 most often in older applications. But recently, some code has appeared in which you have an object declaration, but creating an instance is done using some kind of structure, for example Spring. The instance is stored inside the container. However, learning about this process.
public class DataService { MyWebServiceClient client; public void Method1() { var v = client.Operation1(); ... } public void Method2() { var v = client.Operation2(); ... } }
snail source share