This is a really strange requirement. That said, here's how you can do this:
// 1. Define your universe of types.
// If you don't know where to start, you could try all the
// types that have been loaded into the application domain.
var allTypes = from assembly in AppDomain.CurrentDomain.GetAssemblies()
from type in assembly.GetTypes()
select type;
// 2. Search through each type and find ones that have a public
// property named "FirstName" (In your case: the `Name` type).
var typesWithFirstNameProp = new HashSet<Type>
(
from type in allTypes
where type.GetProperty("FirstName") != null
select type
);
// 3. Search through each type and find ones that have at least one
// public property whose type matches one of the types found
// in Step 2 (In your case: the `Person` type).
var result = from type in allTypes
let propertyTypes = type.GetProperties().Select(p => p.PropertyType)
where typesWithFirstNameProp.Overlaps(propertyTypes)
select type;
Person.PersonName.FirstName == "Bob", that somewhere you can have a methodPerson FindPersonByName(string name), feed in "Bob" and it will return you the instance of thePersonclass in memory that was assigned "Bob" previously?FindTypesWithPropertyName("FirstName")and it would return bothtypeof(Name)andtypeof(Person)?