title: Enum Boxing and Equality
body: <p>Why does this return False</p>
  
  <pre><code>    public enum Directions { Up, Down, Left, Right }
  
      static void Main(string[] args)
      {
          bool matches = IsOneOf(Directions.Right, Directions.Left, Directions.Right);
          Console.WriteLine(matches);
          Console.Read();
      }
  
      public static bool IsOneOf(Enum self, params Enum[] values)
      {
          foreach (var value in values)
              if (self == value)
                  return true;
          return false;
      }
  </code></pre>
  
  <p>while this returns True?</p>
  
  <pre><code>    public static bool IsOneOf(Enum self, params Enum[] values)
      {
          foreach (var value in values)
              if (self.Equals(value))
                  return true;
          return false;
      }
  </code></pre>