private void AddSubcommandImpl <TSubCommand>(ConventionContext context, SubcommandAttribute subcommand) where TSubCommand : class { #pragma warning disable 618 context.Application.Command <TSubCommand>(subcommand.Name !, subcommand.Configure); #pragma warning restore 618 }
private void AddSubcommandImpl <TSubCommand>(ConventionContext context, SubcommandAttribute subcommand) where TSubCommand : class, new() { if (context.Application.Commands.Any(c => c.Name.Equals(subcommand.Name, StringComparison.OrdinalIgnoreCase))) { throw new InvalidOperationException(Strings.DuplicateSubcommandName(subcommand.Name)); } context.Application.Command <TSubCommand>(subcommand.Name, subcommand.Configure); }