C# (Generic of a Generic)?

c#, generics

Solution

The generic constraint might not be quite what you want, but is this basically what you're looking for? This constrains TCollection to be an `IEnumerable<T>` (although IEnumerable can be swapped for List/Collection/Etc...)

public static IEnumerable<T> Where<T, TCollection>(this TCollection sourceCollection, Expression<Func<T, bool>> expr)
where TCollection : IEnumerable<T>, INotifyPropertyChanged
{
    throw new NotImplementedException();
}

Update: just changed my sample a little to better follow the method--I'd been confused and didn't realize you wanted a `Where()` method, I assumed it was your generic-constraint `where`.

Problem

Is there any way to express this idea in C#? (Basically a generic type of a generic type)? ``` 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(); } } ```

Original source