public partial class MainWindow: Window {
public static ABClient client;
public MainWindow() {
InitializeComponent();
client=new ABClient();
client.Connect();
}
}
class B {
public B() {
client.Connect(); // The name 'client' does not exist in the current context
}
}
Why do I get this compile error if client is public? I need to have one client which would be accessible from any other window or class. Please help with the solution.