Question
What is the difference between setting a [...].DataSource
to an instance of an object vs. the type of a class? I have seen both methods in use in our codebase, and I'm trying to wrap my head around why it is one way or the other in any of these cases.
Example
How does
object1.DataSource = typeof(SomeClass);
differ from
object2.DataSource = getSomeObject();
Further inquery
Also, in the first case, if I set a DataSource
to be the type of a class, what happens if that class is a base class? Does the data binding work on properties that only exist in classes that descend from the base class? Or does the data binding only work on the class members of the type of the class I set the DataSource
to?
I'm having a hard time wording my Google
search queries to give me an answer to this question. And that is either because this stuff is complicated and I'm just not wording it right, or I do not quite understand some of the fundamentals of data binding in C#. Could I get some help getting pointed in the right direction here? Thanks!