What does “where T : somevalue” mean?

前端 未结 4 1315
暖寄归人
暖寄归人 2021-02-05 22:14

What does where T : somevalue mean? I just saw some code that said where T : Attribute. I think this has something to do with generics but I am not sur

4条回答
  •  無奈伤痛
    2021-02-05 22:42

    Additionally what the others said, you have the following too:

    • new() - T must have default constructor
    • class - T must be a reference type
    • struct - T must be a value type

提交回复
热议问题