Search code examples
c#blazor-server-sideasp.net-blazor

Are generic type constraints possible in blazor?


How can I restrict TModel to be classes only or to be implementing a specific interface?

@typeparam TModel

cannot get the syntax working.


Solution

  • The solution is to put the type constraint additionally in a partial code behind class. It works!