You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/NzbDrone.Common/ReflectionExtentions.cs

25 lines
735 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace NzbDrone.Common
{
public static class ReflectionExtensions
{
public static IEnumerable<Type> GetInterfaces(this Assembly assembly)
{
return assembly.GetTypes().Where(c => c.IsInterface);
}
public static IEnumerable<Type> GetImplementations(this Assembly assembly, Type contractType)
{
return assembly.GetTypes()
.Where(implementation =>
contractType.IsAssignableFrom(implementation) &&
!implementation.IsInterface &&
!implementation.IsAbstract
);
}
}
}