How can I use interface as a C# generic type constraint?

The closest you can do (except for your base-interface approach) is “where T : class“, meaning reference-type. There is no syntax to mean “any interface”.

This (“where T : class“) is used, for example, in WCF to limit clients to service contracts (interfaces).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)