title: What are the benefits of using the RelayCommand object
body: <p>I want to know what the advantage are using the relay command to call functions that refresh the screen.  In my application I have the following relay command setup.</p>
  
  <pre><code>private RelayCommand _refreshSitesCommand;
      public RelayCommand RefreshSitesCommand
      {
          get { return _refreshSitesCommand ?? (_refreshSitesCommand = new RelayCommand(RefreshSites)); }
      }
  
      private RelayCommand _refreshProvidersCommand;
      public RelayCommand RefreshProvidersCommand
      {
          get { return _refreshProvidersCommand ?? (_refreshProvidersCommand = new RelayCommand(RefreshProviders)); }
      }
  
      private async void RefreshSites()
      {
          var sitesStats = await _dataService.GetSiteStats();
  
          if (sitesStats != null)
          {
              SiteStats.Clear();
  
              foreach (var site in sitesStats)
              {
                  SiteStats.Add(new SiteStatsViewModel(site));
              }
  
              SelectedSite = SiteStats[0];
          }
      }
  
      private async void RefreshProviders()
      {
          var providers = await _dataService.GetProviders();
  
          if (providers != null)
          {
              Providers.Clear();
  
              foreach (var provider in providers)
              {
                  Providers.Add(new ProviderViewModel(provider));
              }
  
              SelectedProvider = Providers[0];
          }
      }
  </code></pre>
  
  <p>Then in my code I have the following calls to execute it.</p>
  
  <pre><code>RefreshProvidersCommand.Execute(null);
  RefreshSitesCommand.Execute(null);
  </code></pre>
  
  <p>So why is that better than just calling the RefreshSites and RefreshProviders functions. Then I would not need the code for the RelayCommand objects.  Other than exposing the functionality of the 2 private functions, what benefit does using the RelayCommand object have over just making the functions public and calling them.   </p>