I was trying to create an extension that could slice any array-like class (since slicing is oddly absent in the standard libraries). For example:
public static M Slice<M,T>(this M source, int start, int end) where M : IList<T>
{
//slice code
}
However, the compiled does not attach this method to objects of type M (even though its error message claims that that is what it is looking for). It seems rather to be dependent upon the type parameters of the method itself, e.g. in some manner, but I don't fully understand how things are working.
(yes, one could easily write an example that just works with List, but I'm curious if this is even possible.)