I don't have access to the C# 4.0 preview yet. But I am curious, what does the C# 4.0 runtime do when invoking an overloaded method in the following case. Does it resolve to the generic overload ... or the specialized overload.
public class Foo<T>
{
protected string BarImpl( T value ) { return "Bar(T) says: " + value.ToString(); }
protected string BarImpl( int value ) { return "Bar(int) says: " + value.ToString(); }
public string Bar( T value )
{
dynamic foo = this;
return foo.BarImpl( value );
}
}
public static void Main( string args[] )
{
var f = new Foo<int>();
Console.WriteLine( f.Bar( 0 ) );
}