views:

119

answers:

1

I have following code in Program.cs in console application

class Program : IView
{
  private static ViewPresenter _presenter;

  static void Main(string[] args)
  {
      _presenter = new ViewPresenter(this);  
  }
}

but I cant pass this to presenter, as Main method is static. Now how could I make this work ?

+1  A: 

You have to create an instance of Programm. Main is a static method.

class Program : IView {
      private static ViewPresenter _presenter;

      static void Main(string[] args) {
      _presenter = new ViewPresenter( new Programm());  
     }
  }
Jehof
Thanks, I used same solution just before you answer this question :)
Prashant
If this is the solution you used, than please accept the answer.
John Kraft