I have the following methods:
public void Say<TItem>(TItem item)
{
Console.WriteLine("A");
}
public void Say<TItem>(IEnumerable<TItem> items)
{
Console.WriteLine("B");
}
When I run the following:
void Main()
{
Say<string>("Foo");
Say(new string[] { "Foo", "Bar"});
}
The first method is invoked twice:
A
A
Note changing the IEnumerable<T>
to a TItem[]
does work as expected but in the case of the IEnumerable<T>
why is it not picking up the second method? How can I achieve the intended overloading?