I have a base class CrmObject and a few classes that inherit it (Aufgabe, Kontakt, ...). I only have a string-value for the child-class and I want to get both the Properties of CrmObject and the specific child-class in one Statement.
I'd get the properties of the child-class like this:
var propertyInfos = typeof(CrmObject).Assembly.GetType("Aufgabe").GetProperties().Where(p => Attribute.IsDefined(p, typeof(ImportParameter)));
But I'd like to get the Properties of CrmObject, too. Possibly within the same statement.
[UPDATE] This should be it. I'll test it later. Thank you, guys. :)
var propertyInfos = typeof(CrmObject).Assembly.GetType("DAKCrmImport.Core." +crmType).GetProperties().Where(p => Attribute.IsDefined(p, typeof(ImportParameter)));
Weirdly enough you don't need the bindingflag parameter to flatten the hierarchy. Apparently it's the default value? Well .. whatever. It works :)