[Solved] How to call a non-static method from another class without using instances in c#?


This all depends on the functionality of your Connections class.

The easiest answer I can give is that you can make the individual methods static, assuming they don’t require instance specific data.

If your individual methods require instance specific data, then you could possibly make the instance a singleton instance (either through have an Instance readonly property, or configuring an IOC container). The singleton works if everyone in the memory context will be using the same instance.

If different instances are needed, but need to be shared across some items, then you can look at structuring your code as having a parent ViewModel that contains the instance that the children ViewModels care about. The children would then have a reference to the parent ViewModel.

solved How to call a non-static method from another class without using instances in c#?