title: Explain how delegates work in the following code?
body: <p>I am curious on how the following code works, especially the part the contains the delegate stuff since I am new to it.  Also, are there any bottlenecks in the code, for example, would using a SortedDictionary be better than using a List and then sorting it using LINQ?  Ok, here is the code:</p>
  
  <pre><code>public class ColorManager
  {
      private List&lt;ColorData&gt; colorCodes = new List&lt;ColorData&gt;();
  
      public List&lt;ColorData&gt; ColorCodes
      {
          get
          {
              var sortList = from a in this.colorCodes
                             orderby a.colorCode ascending
                             select a;
  
              return sortList.ToList();
          }
      }
  
      public void FillData(DataTable table)
      {
          for(int row = 0; row &lt; table.Rows.Count; row++)
          {
              ColorData cData = new ColorData();
              string name = table.Rows[row]["Color"].ToString().Trim();
  
              if(!this.colorCodes.Exists(
                  delegate(ColorData e)
                  {
                      return e.ColorCode == name;
                  }))
              {
                  cData.Add(table.Rows[row]["Color"].ToString());
                  this.colorCodes.Add(cData);
              }
              else
              {
                  this.colorCodes.Find(
                      delegate(ColorData e)
                      {
                          return e.ColorCode == name;
                      }).Count++;
              }
          } 
      }
  }
  </code></pre>