Sign up ×

I'm trying to get a list of classes that implement a certain interface in windows 8 store apps but it seems that reflection is very different in WinRT and so far I couldn't find a good example of doing so.

Does anyone know, how to load the current assembly and loop through it?

Any help is much appreciated :)

share|improve this question
Do you need to know which classes you can use because this is well documented. –  Ramhound Nov 13 '12 at 18:38
@Ramhound I'm not quite sure what you're asking, in my scenario I have over 100 rules and each rule has a unique name and implements IRule interface. I want to get all classes that implement IRule interface. –  Soroush Mirzaei Nov 13 '12 at 19:20
Did you look this a thread? Maybe it help you NG –  Nelson Godinho Nov 14 '12 at 14:11
@NelsonGodinho The answer below works perfectly, I'd mark it as answer but I can't until tomorrow. Thanks anyway :) –  Soroush Mirzaei Nov 14 '12 at 15:04

1 Answer 1

up vote 8 down vote accepted

Got an answer from the MSDN forums. Just posting it here in case someone else is looking for the same thing.

This code will get all classes that implement IDisposable interface:

// We get the current assembly through the current class
var currentAssembly = this.GetType().GetTypeInfo().Assembly;

// we filter the defined classes according to the interfaces they implement
var iDisposableAssemblies = currentAssembly.DefinedTypes.Where(type => type.ImplementedInterfaces.Any(inter => inter == typeof(IDisposable))).ToList();
share|improve this answer

Your Answer


