通用函数声明

0 c# generics dictionary

我已经声明了我的泛型函数如下

public static Dictionary<TZerokey, Dictionary<TFirstKey, Dictionary<TSecondKey, TValue>>> 
    PivotCountry<TSource,TZeroKey, TFirstKey, TSecondKey, TValue>
    (this IEnumerable<TSource> source,Func<TSource,TZeroKey> zerokeySelector, 
     Func<TSource, TFirstKey> firstKeySelector,
     Func<TSource, TSecondKey> secondKeySelector,
     Func<IEnumerable<TSource>, TValue> aggregate)
{

    return null;//return value is not important for my question
}
Run Code Online (Sandbox Code Playgroud)

我收到编译错误

无法找到TZerokey.您是否缺少using指令或程序集引用?

有人能告诉我我的申报有什么问题吗?

提前致谢

Jon*_*eet 5

是的 - 你有一个拼写错误:TZerokey在返回类型中,但TZeroKey在type参数中.注意"K"的大小写的不同.所以TZerokey没有找到,但TZeroKey会.