title: C# Delegate problem - what the heck does this code do?
body: <p>Can anyone explain to me what the following line of C# code does?</p>
  
  <pre><code>public event EventHandler&lt;DataEventArgs&lt;BusinessEntities.Employee&gt;&gt; EmployeeSelected = delegate { };
  </code></pre>
  
  <p>The bit that's really got me stumped is the <code>delegate { }</code> piece at the end. For a bit more context, the sample from the EmployeesListView.xaml.cs in the ViewInjection sample that ships with PRISM 2. The full class definition is shown below:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Interaction logic for EmployeesListView.xaml
  /// &lt;/summary&gt;
  public partial class EmployeesListView : UserControl, IEmployeesListView
  {
      public EmployeesListView()
      {
          InitializeComponent();
      }
  
      public ObservableCollection&lt;BusinessEntities.Employee&gt; Model
      {
          get { return this.DataContext as ObservableCollection&lt;BusinessEntities.Employee&gt;; }
          set { this.DataContext = value; }
      }
  
      public event EventHandler&lt;DataEventArgs&lt;BusinessEntities.Employee&gt;&gt; EmployeeSelected = delegate { };
  
      private void EmployeesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
      {
          if (e.AddedItems.Count &gt; 0)
          {
              BusinessEntities.Employee selected = e.AddedItems[0] as BusinessEntities.Employee;
              if (selected != null)
              {
                  EmployeeSelected(this, new DataEventArgs&lt;BusinessEntities.Employee&gt;(selected));
              }
          }
      }
  }
  </code></pre>