zoukankan      html  css  js  c++  java
  • where T : class的含义

    [csharp] view plaincopy
     
    public class Reflect<T> where T : class
    {  
    

    这是参数类型约束,指定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的接口

  • 相关阅读:
    youtube-VisualSfM and MeshLab workflow video-meshlab part integration
    testing_lab1
    homework2-st
    homework1-spm
    homework1-st
    just one last blog
    week 10
    week 9
    week 8
    课后题7
  • 原文地址:https://www.cnblogs.com/nov5026/p/4724790.html
Copyright © 2011-2022 走看看