有没有办法在C#中表达这个想法?(基本上是一个泛型类型的泛型类型)?
public static class ExtensionSpike
{
public static IEnumerable<T> Where<TCollection<T>>(this TCollection<T> sourceCollection, Expression<Func<T, bool>> expr)
where TCollection : class, IEnumerable<T>, INotifyCollectionChanged
{
throw new NotImplementedException();
}
}
Func<T1, TResult>
的模式(泛型参数在结果类型之前)使用Where<TCollection, T>
而不是Where<T, TCollection>
。 - Sam Harwell