I get a RuntimebinderException when I call an inherited interface method that passes dynamic as one of the arguments.
I do not understand this behavior.
Here is a complete example:
using System;
class Program
{
static void Main(string[] args)
{
dynamic dyn = new Record();
IAdvancedTable advTable = new Table();
ITable table = advTable;
table.Insert(dyn);
advTable.Insert(dyn);
Console.ReadKey();
}
}
public interface ITable
{
void Insert(Record record);
}
public interface IAdvancedTable : ITable{}
public class Table : IAdvancedTable
{
public void Insert(Record record){ }
}
public class Record{}
There seems to be no recursion in RuntimeBinder to test for "inherited interfaces" on a real interface. But is there a reason for this?
source
share