where T : class的含義

.NET支持的類型參數約束有如下五種:
where T : struct                               | T必須是一個結構類型
where T : class                                | T必須是一個Class類型
where T : new()                               | T必需要有一個無參構造函數
where T : NameOfBaseClass          | T必須繼承名爲NameOfBaseClass的類
where T : NameOfInterface             | T必須實現名爲NameOfInterface的接口
函數

相關文章
相關標籤/搜索