如何在控制台应用程序中实现 MVP?
我在控制台应用程序的 Program.cs 中有以下代码
class Program : IView
{
private static ViewPresenter _presenter;
static void Main(string[] args)
{
_presenter = new ViewPresenter(this);
}
}
,但无法将 this
传递给演示者,因为 Main 方法是 static
。现在我怎样才能做到这一点?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须创建一个
Program
实例。 Main 是一个静态方法。You have to create an instance of
Program
. Main is a static method.