Situation I have 3 Interface defined as follows.
public interface IA { long ID { get; set; } }
public interface IB : IA { string Name { get; set; } }
public interface IC : IB { string City { get; set; } }
Then I have a class called SampleClass
that implements IC
and in that class, I have a method called GetData()
which returns List<IC>
.
Then in my Windows Form, I have a DataGridView
. I am binding the grid as follows.
SampleClass sampleClass = new SampleClass();
List<IC> list = new List<IC>();
foreach (var item in sampleClass.GetData())
{
list.Add(((C)item));
}
dataGridView1.DataSource = list;
Question
The Grid displays only the fields from Interface IC
and none of the fields from interface IB
or IA
shows up. Any idea why?