Plesase examine the following code snippet. It was shortened but has all important bits.
I have a 'Client' class and two classes that inherit from this class: 'NaturalPerson' and 'LegalPerson'.
In my data access code i generate a generic list of Clients (List<Client>). This list includes some LegalPersons and some NaturalPersons.
When i try to bind this list to a datagrid i get the 'Object does not match target type' error.
public class Client
{
public virtual String Name
{
get { return ""; }
set { }
}
}
public class NaturalPerson: Client
{
private String firstName;
public String FirstName
{
get { return this.firstName; }
set { this.firstName = value.Trim(); }
}
private String lastName;
public Stri ...
Go to the complete details ...