How do I check if class inherits from my class DataSource (abstract class).
here is what I got:
var q = from t in Assembly.Load(new AssemblyName("DefaultDataSources")).GetTypes()
where t.IsClass
select t;
I don't know what condition to add :(
It sounds like you just want:
var query = Assembly.Load(...)
.GetTypes()
.Where(t => typeof(DataSource).IsAssignableFrom(t));
(The IsAssignableFrom
part is the interesting bit, but I gave the full query as this is a good example of a case where a query expression just gets in the way - a single call to the Where
extension method is simpler.)
See more on this question at Stackoverflow