title: Re-evaluate LINQ query when ObservableCollection changes
body: <p>I have a common issue that I'd like to (hopefully) find a better solution for moving forward.  I have an ObservableCollection containing a master list of data.  In my client code I need to 'transform' the data into a new form for display to the user.  I use a LINQ statement like:</p>
  
  <pre><code>var newList = (from item in observable
                 select new { FirstInitial = item.Name[0] });
  </code></pre>
  
  <p>I know it's pretty rudimentary but it is enough to demonstrate the problem.  (Notice the projection, this is not a simple filter or grouping statement.)  I then display newList in my UI via data-binding.</p>
  
  <p>Problem is, when the original collection changes, the UI doesn't.  The solution I've applied thus far has been to attach an event handler to the original collection's CollectionChanged event which re-evaluates the query and updates the bound property.</p>
  
  <p>While this works fine, it's a lot of repeated code every time I run across this scenario.  Is there a way that I can have the LINQ query return an ObservableCollection that "automatically" updates when the source Observable is changed?</p>
  
  <p>In other words, I'd like to implement some 'canned' functionality so I can simply reuse it whenever I have this scenario.</p>
  
  <p>UPDATE</p>
  
  <p>Thanks to Scroog1 for helping me see my original post was too coupled to the UI for what I was really asking.  Take the following example as a better description of the problem:</p>
  
  <pre><code>public class SomeClass
  {
      private ObservableCollection&lt;Employee&gt; _allEmployees;
      private ObservableCollection&lt;Employee&gt; _currentEmployees;
  
      public ObservableCollection&lt;Employee&gt; CurrentEmployees
      {
          get
          {
              if (_currentEmployees == null)
                  _currentEmployees = _allEmployees.Where(e =&gt; !e.IsTerminated);
  
              return _currentEmployees;
          }
      }
  }
  
  public class SomeViewModel
  {
      private ICollectionView _view;
  
      public ICollectionView CurrentView
      {
          if (_view == null)
          {
              var cvs = new CollectionViewSource()
              {
                  Source = someClass.CurrentEmployees
              }
  
              cvs.Add(new SortDescription("Name", ListSortDirection.Ascending));
  
              _view = cvs.View;
          }
  
          return _view;
      }
  }
  </code></pre>
  
  <p>As you can see, the code where the query exists is not what is directly bound to the UI.  I use this example to demonstrate that I am asking from a more general use-case than strictly a UI data-binding scenario.</p>