在C#是什么',其中T:类'是什么意思? [英] In c# what does 'where T : class' mean?

查看:329
本文介绍了在C#是什么',其中T:类'是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#是什么其中T:类是什么意思?



IE浏览器。

 公开的IList< T> DoThis< T>()其中T:类


解决方案

简单把这个是制约泛型参数的一类(或更具体地说这可能是一个类,接口,委托或数组类型的引用类型)。



请参阅此 MSDN文章进一步的细节。


In C# what does where T : class mean?

Ie.

public IList<T> DoThis<T>() where T : class

解决方案

Simply put this is constraining the generic parameter to a class (or more specifically a reference type which could be a class, interface, delegate, or array type).

See this MSDN article for further details.

这篇关于在C#是什么',其中T:类'是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆