Imagine that I have a general class `Person`. Then I have specializations of that class, for example `DanishPerson` and `BritishPerson`.

Now I need a function that returns the correct instance of Persons, depending on what country they are in, or a way to easily determine what type of persons they are. So I have the function:

```
List<Person> GetPersonsByCountry(int countryId)
{
    // query database, and get list of Persons in that country using EF inheritance
    // return list of persons
}

```

The list of persons, contains objects that are *either* of type `DanishPerson` or `BritishPerson`. Depending on the type, I need to display the right ViewModel in my UI. So if the list contains danish persons of type `DanishPerson`, I need to display one UI that will show the danish specific properties (and more).

Now my question is how you do this the best way? I guess that I could always use an if/else using `typeof`, but I was hoping for a more elegant, and maybe generic way?
I was thinking that there might be some patterns for doing this as it seems like a common problem to me, when dealing with specializations?