I have the following class:
我有以下课程:
public class ViewPage<TView,TPresenter> : Page
where TView : IView
where TPresenter : Presenter<TView>
{
public ViewPage()
{
if (!(this is TView))
throw new Exception(String.Format("The view must be of type {0}", typeof(TView)));
IWindsorContainer container = new WindsorContainer();
container.AddComponent("view", typeof(IView), typeof(TView));
container.AddComponent("presenter", typeof(Presenter<TView>), typeof(TPresenter));
TPresenter presenter = container[typeof(TPresenter)] as TPresenter;
}
}
public