title: Equality of two structs in C#
body: <p>I look for an equality between two instances of this struct.</p>
  
  <pre><code>public struct Serie&lt;T&gt;
  {
      T[]         X; 
      double[]    Y;
  
      public Serie(T[] x, double[] y)
      {
          X = x;
          Y = y;
      }
  
      public override bool Equals(object obj)
      {
          return obj is Serie&lt;T&gt; &amp;&amp; this == (Serie&lt;T&gt;)obj;
      } 
      public static bool operator ==(Serie&lt;T&gt; s1, Serie&lt;T&gt; s2)
      {
          return s1.X == s2.X &amp;&amp; s1.Y == s2.Y;
      }
      public static bool operator !=(Serie&lt;T&gt; s1, Serie&lt;T&gt; s2)
      {
          return !(s1 == s2);
      }
  </code></pre>
  
  <p>This doesn't work. What am I missing?</p>
  
  <pre><code>        double[] xa = { 2, 3 };
          double[] ya = { 1, 2 };
          double[] xb = { 2, 3 };
          double[] yb = { 1, 2 };
          Serie&lt;double&gt; A = new Serie&lt;double&gt;(xa, ya);
          Serie&lt;double&gt; B = new Serie&lt;double&gt;(xb, yb);
          Assert.AreEqual(A, B);
  </code></pre>