I wrote some extension methods to convert IEnumerable and IList to string. Now that IList inherits from IEnumerable, I have to call them differently.
I'm just wondering if there is a way to avoid this? Can I have an extension method in IEnumerable and then another in IList with the same name and same signature? Kinda, as an override, except that extension methods are, of course, static.
I just would like to use a more efficient method object in the list without having a middle name for the method.
And yes, I know that in this particular case, I must first run the profiler to really see if the second method is better, but I am wondering if you can override extension methods in derived classes at all.
source
share