I still haven't upgraded to 4.0 else I would have checked the code snippet myself. But I hope some expert can comment on this.
In following code, will the appropriate Print()
method be called at runtime? Is it even legal in C# 2010 to call it that way?
public void Test()
{
dynamic objX = InstantiateAsStringOrDouble();
Print(objX);
}
public void Print(string s)
{
Console.Write("string");
}
public void Print(double n)
{
Console.Write("double");
}
Thanks!