понедельник, 4 ноября 2019 г.

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

https://stackoverflow.com/questions/1096568/how-can-i-use-interface-as-a-c-sharp-generic-type-constraint

Is there a way to get the following function declaration?
public bool Foo<T>() where T : interface;
ie. where T is an interface type (similar to where T : class, and struct).
Currently I've settled for:
public bool Foo<T>() where T : IBase;

Комментариев нет:

Отправить комментарий