将使用哪种扩展方法?

问题描述 投票:-2回答:1

我无法自己解释哪种扩展方法与当前的MS API文档相匹配,请查看图片。有一个IEnumarable.ToDictionary方法与3个参数FUNC键,FUNC值,FUNC比较器一起使用,顺序如下:

enter image description here

但是在MS API Doc IEnumarable Extension methods中,似乎没有上述方法的匹配定义(键,值,比较器)。

enter image description here

谁能解释一下?

c# .net mono
1个回答
0
投票

比较器不是“FUNC” - 它是一个new NonUniqueComparer(),我猜这是一种实现IEqualityComparer<T>的类型。

Intellisense告诉你它选择了(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)重载(其中TSource'aTKeyobject,而TElementobject),这是你的截图中的底部。

© www.soinside.com 2019 - 2024. All rights reserved.