class A <T> where T: new () is what is meant

This is a C # generic class declaration syntax
class A <T> A class represents acceptance of a certain type, generic type T, you need to run time passed
where indicates the type of a variable constraints T's. where T: new () T indicates the created instance should have when the constructor . Under normal circumstances, you can not create an instance of a generic type parameter. However, new new () constraint changed this situation, the request type parameter must provide a constructor with no arguments.

Guess you like

Origin www.cnblogs.com/bwdblogs/p/11723792.html