using System.Reflection; namespace AdventOfCodeLibrary.Shared { public class AnswerableListBuilder { public static IEnumerable AnswerableList() { Type type = typeof(Answerable); IEnumerable instances = Assembly.GetExecutingAssembly().GetTypes() .Where(t => t.GetInterfaces().Contains(type) && t.GetConstructor(Type.EmptyTypes) != null ) .Select(t => Activator.CreateInstance(t) as Answerable) .Where(i => i != null); // try to filter null var noneNull = instances.Where(i => i != null); return new List(); } } }