0
我正忙于编写我自己的集合类型,并且需要有一个函数 返回集合中值的最大值,其中一个值属性是最大或某些条件成立。如何实现通用最大<TSource>(Func <TSource,TSource> func)
所以我想在底层.NET的收藏品之一叫马克斯(Func键< ...),但我 似乎无法得到它的工作:
public TValue MaxValue(Func<TValue,TValue> func)
{
return this.valueSet.Max<TValue>(func);
}
但我获得2个错误:
Argument 2: cannot convert from 'System.Func<TValue,TValue>' to System.Func<TValue,int>'
和
'System.Collections.Generic.SortedSet<TValue>' does not contain a definition for 'Max'
and the best extension method overload 'System.Linq.Enumerable.Max<TSource>(System.Collections.Generic.IEnumerable<TSource>,
System.Func<TSource,int>)' has some invalid arguments
我只是不能似乎figu再出什么,我要在这里做...
感谢我的一个新手的错误! 。 – Vort3x