.NET Core 1.1 supports Type.GetInterfaces() method which provides a list of the interfaces implemented on a given type. Unfortunately, Type.GetInterfaces() is not yet available in .NET Standard 1.x.
The good news is that it is supposed to included in .NET Standard 2.0.
In the meantime, does anyone know of a workaround I can use to get the list of interfaces on a type and/or the list of classes which implement a given interface in .NET Standard 1.x?
Many thanks!
This should do the trick. GetTypeInfo() is an extension method in the System.Reflection namespace, part of the InstrospectionExtensions.
using System.Reflection;
var interfaces = typeof({SOME_TYPE}).GetTypeInfo().GetInterfaces();
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