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.
Lidarr/src/NzbDrone.Common/Composition/KnownTypes.cs

32 lines
761 B

using System;
using System.Collections.Generic;
using System.Linq;
namespace NzbDrone.Common.Composition
{
public class KnownTypes
{
private List<Type> _knownTypes;
// So unity can resolve for tests
public KnownTypes()
: this(new List<Type>())
{
}
public KnownTypes(List<Type> loadedTypes)
{
_knownTypes = loadedTypes;
}
public IEnumerable<Type> GetImplementations(Type contractType)
{
return _knownTypes
.Where(implementation =>
contractType.IsAssignableFrom(implementation) &&
!implementation.IsInterface &&
!implementation.IsAbstract);
}
}
}