I read from https://msdn.microsoft.com/en-us/library/vstudio/bb383977.aspx that extension methods with same name and signature as existing ones on the base type are never called, but what about "overriding" an extension-method itself:
using System;
using System.Linq;
using System.Collections.Generic;
namespace ConsoleApplication1
{
public class Program
{
public static void Main(string[] args)
{
var query = (new[] { "Hans", "Birgit" }).Where(x => x == "Hans");
foreach (var o in query) Console.WriteLine(o);
}
}
public static class MyClass
{
public static IEnumerable<T> Where<T>(this IEnumerable<T> source, Func<T, bool> predicate)
{
foreach (var obj in source)
if (predicate(obj)) yield return obj;
}
};
}
When I debug this program I DO run into my own extension-method rather then that one provided by System.Linq (although the namespace is included). Did I miss anything or is there also a priority for extension-methods?