jjzjj

IInputBoxService

全部标签

c# - 关于 C# 4.0 泛型协变的问题

定义了这个接口(interface):publicinterfaceIInputBoxService{boolShowDialog();TResult{get;}}为什么下面的代码有效:publicclassStringInputBoxService:IInputBoxService{...}...IInputBoxServiceservice=newStringInputBoxService();这不是吗?publicclassIntegerInputBoxService:IInputBoxService{...}...IInputBoxServiceservice=newInteg