public void Test<TFeature>(Func<TController, ViewResult> controllerAction)
where TController : IController
where TFeature : ISecurityFeature
{
...
}
I'm getting the error, Test does not define type parameter TController. How can I put a constraint on TController?
Unless you are defining it inside SomeClass<TController>
(in which case you need to put constraint next to class SomeClass<TController>
), you need to make TController
a generic argument of your function, i.e.:
public void Test<TFeature, TController>(Func<TController, ViewResult> controllerAction)
where TController : IController
where TFeature : ISecurityFeature
{
...
}
You need to add the TController as a generic parameter too
public void Test<TFeature, TController>(Func<TController, ViewResult> controllerAction)
where TController : IController
where TFeature : ISecurityFeature
{
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With