Hi everyone,
Just for testing reasons, I defined my own Where-Method for Linq like so:
namespace Test
{
public static class LinqTest
{
public static IEnumerable<TSource> Where<TSource>(
this IEnumerable<TSource> source,
Func<TSource, bool> predicate)
{
return new List<TSource> { };
}
}
}
So if I use a query like this, I never get a result:
var test = new string[]{ "a", "b", "c" };
var x = from y in test
where y.Length > 0
select y;
foreach (var element in x)
Console.WriteLine(element);
My question is: How does the compiler know which extension method is supposed to be called? The one included in LINQ, or the user-defined one?
Cheers, Chris