title: Is it possible to reduce the number of constructors I am using in this code? Constructor overloading and forwarding with multiple classes
body: <p>I wrote this code earlier today. The purpose of the code is to implement ICommand such that it exclusively runs only one method at a time, and returns silently for others. </p>
  
  <p>I wrote it for use with a multi-platform user interface so that multiple key presses aren't registered.</p>
  
  <p>It has a ton of constructors, and I don't understand overloading of this sort very well. I am taking design patterns next semester and Object Oriented Programming the semester after that, so hopefully my code will be cleaner after that!</p>
  
  <p>Is there a way for me to shorten the code (reduce the number of constructors needed)?</p>
  
  <pre class="lang-C# prettyprint-override"><code>using System;
  using Xamarin.Forms;
  using System.Windows.Input;
  using System.Threading.Tasks;
  
  namespace dobjenkins
  {
      public interface IAsyncCommand : ICommand
      {
          Task ExecuteAsync (object parameter);
      }
  
      public class AsyncCommand : IAsyncCommand
      {
          private readonly Func&lt;object, Task&gt; execute;
          private readonly Func&lt;object, bool&gt; canExecute;
  
          ///
          /// Constructors and initializors
          ///
          protected AsyncCommand ()
          {
          }
  
          public AsyncCommand (Func&lt;object, Task&gt; execute, Func&lt;object, bool&gt; canExecute)
          {
              this.execute = execute;
              this.canExecute = canExecute;
          }
  
          public AsyncCommand (Func&lt;object, Task&gt; execute)
          {
              this.execute = execute;
          }
  
          public AsyncCommand (Func&lt;Task&gt; execute, Func&lt;bool&gt; canExecute)
          {
              this.execute = _ =&gt; execute ();
              this.canExecute = _ =&gt; canExecute ();
          }
  
          public AsyncCommand (Func&lt;Task&gt; execute)
          {
              this.execute = _ =&gt; execute ();
          }
  
          ///
          ///  Execute Methods
          ///
  
  
          public async Task ExecuteAsync (object parameter)
          {
              await execute (parameter);
          }
  
          public async void Execute (object parameter)
          {
              await ExecuteAsync (parameter);
          }
  
  
          /// 
          /// CanExecute methods/Event
          ///
  
          public event EventHandler CanExecuteChanged;
  
          public void ChangeCanExecute ()
          {
              var ev = CanExecuteChanged;
              if (ev != null) {
                  ev (this, EventArgs.Empty);
              }
          }
  
          public bool CanExecute (object parameter)
          {
              return canExecute == null || canExecute (parameter);
          }
      }
  
      public sealed class AsyncCommand&lt;T&gt; : AsyncCommand
      {
          private readonly Func&lt;T, Task&gt; execute;
          private readonly Func&lt;T, bool&gt; canExecute;
  
          public AsyncCommand (Func&lt;T, Task&gt; execute)
          {
              this.execute = execute;
          }
  
          public AsyncCommand (Func&lt;T, Task&gt; execute, Func&lt;T, bool&gt; canExecute)
          {
              this.execute = execute;
              this.canExecute = canExecute;
          }
  
          ///
          ///  Execute Methods
          ///
  
          public async Task ExecuteAsync (T parameter)
          {
              await execute (parameter);
          }
  
          public async void Execute (T parameter)
          {
              await ExecuteAsync (parameter);
          }
  
          public bool CanExecute (T parameter)
          {
              return canExecute == null || canExecute (parameter);
          }
      }
  
      public class ExclusiveCommand : ICommand
      {
          protected ICommand Backing;
          protected static bool IsBusy = false;
  
  
          // 
          //  Constructors
          //
          #region Constructors
          public ExclusiveCommand()
          {
          }
  
          //
          // SYNC (normal) CONSTRUCTORS
          //
  
          public ExclusiveCommand (Action&lt;object&gt; execute, Func&lt;object, bool&gt; canExecute)
          {
              Backing = new Command (execute, canExecute);
          }
  
          public ExclusiveCommand (Action&lt;object&gt; execute)
          {
              Backing = new Command (execute);
          }
  
          public ExclusiveCommand (Action execute, Func&lt;bool&gt; canExecute)
          {
              Backing = new Command (execute, canExecute);
          }
  
          public ExclusiveCommand (Action execute)
          {
              Backing = new Command (execute);
          }
  
          //
          // ASYNC CONSTRUCTORS
          //
  
  
          public ExclusiveCommand (Func&lt;object, Task&gt; execute, Func&lt;object, bool&gt; canExecute)
          {
              Backing = new AsyncCommand (execute, canExecute);
          }
  
          public ExclusiveCommand (Func&lt;object, Task&gt; execute)
          {
              Backing = new AsyncCommand (execute);
          }
  
          public ExclusiveCommand (Func&lt;Task&gt; execute, Func&lt;bool&gt; canExecute)
          {
              Backing = new AsyncCommand (execute, canExecute);
          }
  
          public ExclusiveCommand (Func&lt;Task&gt; a)
          {
              Backing = new AsyncCommand (a);
          }
  
          // 
          //  End Constructors
          //
          #endregion Constructors
  
          // Execute
  
          public async void Execute (object parameter)
          {
              if (IsBusy) {
                  return;
              }
              IsBusy = true;
  
              var async = Backing as AsyncCommand;
              if (async != null) {
                  await async.ExecuteAsync (parameter);
              } else {
                  Backing.Execute (parameter);
              }
  
              IsBusy = false;
          }
  
          //
          /// Can execute
          //
  
          public event EventHandler CanExecuteChanged;
  
          public void ChangeCanExecute ()
          {
              var ev = CanExecuteChanged;
              if (ev != null) {
                  ev (this, EventArgs.Empty);
              }
          }
  
          public bool CanExecute (object parameter)
          {
              return Backing.CanExecute (parameter);
          }
      }
  }
  
  public sealed class ExclusiveCommand&lt;T&gt; : ExclusiveCommand
  {
      /// 
      ///  Constructors
      ///
      #region Constructors
      public ExclusiveCommand()
      {
      }
  
      //
      // SYNC (normal) CONSTRUCTORS
      //
  
      public ExclusiveCommand (Action&lt;T&gt; execute, Func&lt;T, bool&gt; canExecute)
      {
          Backing = new Command&lt;T&gt; (execute, canExecute);
      }
  
      public ExclusiveCommand (Action&lt;T&gt; execute)
      {
          Backing = new Command&lt;T&gt; (execute);
      }
  
      //
      // ASYNC CONSTRUCTORS
      //
  
  
      public ExclusiveCommand (Func&lt;T, Task&gt; execute, Func&lt;T, bool&gt; canExecute)
      {
          Backing = new AsyncCommand&lt;T&gt; (execute, canExecute);
      }
  
      public ExclusiveCommand (Func&lt;T, Task&gt; execute)
      {
          Backing = new AsyncCommand&lt;T&gt; (execute);
      }
  
      //
      //  End Constructors
      //
      #endregion Constructors
  }
  </code></pre>