From 59ee2e34d8b39eab22b9c373e04299fb4237b39f Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Tue, 20 Aug 2019 18:12:22 +0300 Subject: [PATCH] Don't add abstract and interface types that implement ICommand --- CliFx/CliApplicationBuilder.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CliFx/CliApplicationBuilder.cs b/CliFx/CliApplicationBuilder.cs index 6eb0494..80fd00e 100644 --- a/CliFx/CliApplicationBuilder.cs +++ b/CliFx/CliApplicationBuilder.cs @@ -38,7 +38,9 @@ namespace CliFx { commandAssembly.GuardNotNull(nameof(commandAssembly)); - var commandTypes = commandAssembly.ExportedTypes.Where(t => t.Implements(typeof(ICommand))); + var commandTypes = commandAssembly.ExportedTypes + .Where(t => t.Implements(typeof(ICommand))) + .Where(t => !t.IsAbstract && !t.IsInterface); foreach (var commandType in commandTypes) AddCommand(commandType);