asp.net-blazor

Are generic type constraints possible in blazor?

╄→гoц情女王★ 提交于 2020-12-23 12:55:32
问题 How can I restrict TModel to be classes only or to be implementing a specifix interface? @typeparam TModel cannot get the syntax working. 回答1: The solution is to additionally put the type constraint in a partial code behind class. It works! 来源: https://stackoverflow.com/questions/60714729/are-generic-type-constraints-possible-in-blazor