读书人

C#泛型请问

发布时间: 2013-11-23 10:52:51 作者: rapoo

C#泛型请教
我想在C#中写个限定泛型。
java中写是这样:
protected <T extends DmCallOutAdapta> T callService(String path, DmCallInput inputParam, Class outputParamType) throws Exception,指定返回类型必须继承DmCallOutAdapta

我C#是这样写的 protected <T : DmCallOutAdapta> T callService(),不对啊?C#该如何写啊?

[解决办法]
本帖最后由 caozhy 于 2013-11-21 12:47:17 编辑

protected T callService<T>(string path, DmCallInput inputParam, Type outputParamType) where T : DmCallOutAdapta
{

}

读书人网 >C#

热点推荐