title: Filter a collection with LINQ vs CollectionView
body: <p>I want to filter a ObservableCollection with max 3000 items in a DataGrid with 6 columns. The user should be able to filter in an "&amp;&amp;"-way all 6 columns.</p>
  
  <p>Should I use LINQ or a CollectionView for it? LINQ seemed faster trying some www samples. Do you have any pro/cons?</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <pre><code>private ObservableCollection&lt;Material&gt; _materialList;
          private ObservableCollection&lt;Material&gt; _materialListInternal;
  
          public MaterialBrowserListViewModel()
          {           
                _materialListInternal = new ObservableCollection&lt;Material&gt;();          
  
              for (int i = 0; i &lt; 2222; i++)
              {
                  var mat = new Material()
                  {
                      Schoolday = DateTime.Now.Date,
                      Period = i,
                      DocumentName = "Excel Sheet" + i,
                      Keywords = "financial budget report",
                      SchoolclassCode = "1",
                  };
                  _materialListInternal.Add(mat);
                  var mat1 = new Material()
                  {
                      Schoolday = DateTime.Now.Date,
                      Period = i,
                      DocumentName = "Word Doc" + i,
                      Keywords = "Economical staticstics report",
                      SchoolclassCode = "2",
                  };
                  _materialListInternal.Add(mat1);
              }
  
              MaterialList = CollectionViewSource.GetDefaultView(MaterialListInternal);
              MaterialList.Filter = new Predicate&lt;object&gt;(ContainsInFilter); 
          }      
  
          public bool ContainsInFilter(object item)
          {
              if (String.IsNullOrEmpty(FilterKeywords))
                  return true;   
  
              Material material = item as Material;
              if (DocumentHelper.ContainsCaseInsensitive(material.Keywords,FilterKeywords,StringComparison.CurrentCultureIgnoreCase))        
                  return true;          
              else          
                  return false;                     
          }
  
          private string _filterKeywords;
          public string FilterKeywords
          {
              get { return _filterKeywords; }
              set
              {
                  if (_filterKeywords == value)
                      return;
  
                  _filterKeywords = value;
                  this.RaisePropertyChanged("FilterKeywords");
                  MaterialList.Refresh();               
              }
          }
  
          public ICollectionView MaterialList { get; set; }
  
          public ObservableCollection&lt;Material&gt; MaterialListInternal
          {
              get { return _materialListInternal; }
              set
              {
                  _materialListInternal = value;
                  this.RaisePropertyChanged("MaterialList");
              }
          } 
  </code></pre>