im trying to create a an mvc framework to define the workflow of a project im working on. I created the view and controller classes and was trying to have the ui controller class be generic in order to have a type of uiview assigned to it when inheriting from ui controller:
UIView class
public class UIView
{
}
UIController class
public class UIController<T> where T : UIView
{
}
Implementation of UIView class
public class UIMenuView : UIView
{
}
Implementation of UIController class with UI Menu View
public class MenuController : UIController<UIMenuView>
{
}
Workflow implementation
void main()
{
var menuController = new MenuController();
SetController(menuController as UIController<UIView>);
}
public void SetController(UIController<UIView> controller, bool asRoot = false)
{
}
The problem is im getting the following error while trying to set the controller:
Cannot convert type 'MenuController' to 'UI.UIController<UI.UIView>' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion [Assembly-CSharp]
Does anybody know what im doing wrong here? Thanks!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.