[Mono-osx] Global Objects

Andrew Ayre andy at britishideas.com
Sat Sep 24 14:34:43 EDT 2011

How do I declare global instances of objects?

When using C# and .NET I would do something like this:

public static program {
  public static Foo MyFoo = new Foo();

  static void main() {
    MainForm = new MainForm(MyFoo);

however with Mono/MonoMac the main function calls NSApplication.Main and
doesn't directly create any windows. How would I pass an instance of
MyFoo to the main window?

Note: I am trying to avoid any references to MainClass in my
windows/window controllers as that creates a tight coupling. I want to
reuse the window classes in other situations hence the desire for loose

Is what I want possible with MonoMac?

thanks, Andy

PGP Key ID: 0xDC1B5864

More information about the Mono-osx mailing list