title: Is there any need to check if a command already exists in a Xamarin view model?
body: <p>I have seen two different variation on creating a command in a ViewModel. These are listed below:</p>
  
  <p>    </p>
  
  <pre><code>public partial class PhrasesFrameViewModel : BaseViewModel
  {
      private ICommand wordGridCmd;
      public ICommand WordGridCmd =&gt; wordGridCmd ?? (wordGridCmd = new Command(() =&gt;
      {
          if (!App.pauseCard)
              if (phrasesFrame.timer1Seconds &gt; 0)
                  phrasesFrame.CancelTimer1();
              else
                  phrasesFrame.CancelTimer2();
       }));
  }
  </code></pre>
  
  <p>and</p>
  
  <p>    </p>
  
  <pre><code>public partial class PhrasesFrameViewModel : BaseViewModel
  {
      public ICommand WordGridCmd { get; private set; }
      WordGridCmd = new Command(() =&gt;
      {
          if (!App.pauseCard)
              if (phrasesFrame.timer1Seconds &gt; 0)
                  phrasesFrame.CancelTimer1();
              else
                  phrasesFrame.CancelTimer2();
       }));
  }
  </code></pre>
  
  <p>Can someone tell me is there any reason for me to do the <code>??</code> check to see if the command already exists or is it more common to go with the second way of defining the command?</p>