The type arguments for method cannot be inferred from the usage

前端 未结 6 1717
盖世英雄少女心
盖世英雄少女心 2020-12-05 04:16

Maybe I\'m overworked, but this isn\'t compiling (CS0411). Why?

interface ISignatur
{
    Type Type { get; }
}

interface IAccess where          


        
6条回答
  •  渐次进展
    2020-12-05 04:45

    I received this error because I had made a mistake in the definition of my method. I had declared the method to accept a generic type (notice the "T" after the method name):

    protected int InsertRecord(CoasterModel model, IDbConnection con)
    

    However, when I called the method, I did not use the type which, in my case, was the correct usage:

    int count = InsertRecord(databaseToMigrateFrom, con);
    

    I just removed the generic casting and it worked.

提交回复
热议问题