私はジェネリック型の条件で、このジェネリッククラスを持っている:C#クラスの制約
public abstract class ReportModel<ReportHandler> where ReportHandler : IReportHandler
その後、私は私が必要なもの、このコントローラクラス
public abstract class ReportController<ReportModelType> : Controller
がその条件である持っていますReportModelTypeは、抽象的なReportModelクラスを継承する必要があります。問題は、ImがReportModelの型引数を強制的に与えることであり、引数を指定したくないということです。このようなワイルドカードが必要です:
public abstract class ReportController<ReportModelType> : Controller where ReportModelType : ReportModel<*any type which satifies ReportModels contraint>
解決方法はありますか?
あなたはタイプアサンプションを強制されますか?私はその部分を理解していません – nocodename
すぐに書く*どこReportModelType:ReportModel *私はエラーを取得する必要があります私はReportModelの型引数を提供する必要があります –