For example, when using reflection.
Example: Example:
object calc = GetCalculator();
Type calcType = calc.GetType();
object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 });
int sum = Convert.ToInt32(res);
what will be:
dynamic calc = GetCalculator();
int sum = calc.Add(10, 20);
This is a big improvement, I think.
But there are more items where this can come in handy. For example, when working with objects of COM interoperability this may come in handy, see:
http://www.devx.com/dotnet/Article/42590
source
share