c# - Generic with T of value type -


is possible define generic class t can belong value type (such int, double , on)?

yes, need struct constraint:

class onlystructs<t> t : struct { } 

but should aware of allows user-defined structs, not int,double etc.. unfortunately there no built-in way restrict t specific types where t : int,double,float.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -