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 :)
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With