title: When using GetPosition for ArrayAdapter, Object with Equal Fields Return UnEqual
body: <p>I have created a dropdown in Android Xamarin from which I would like to auto select a dropdown value on page load. When the page is launched, it is passed a MyClass object with a Num value of 52. My dropdown has been passed an ArrayAdapter which has a list of MyClass objects, one of which has a Num value of 52. When I try to <code>mySpinner.SetSelection(recommendedPosition);</code> it is not working because <code>myClassAdapter.GetPosition(recommendedValue)</code> returns -1</p>
  
  <p>I thought that the example in the following article (which shows me how to override the Equals and Hash functions of MyClass) would help me, but it still results in -1 being returned. It seems that these overridden functions are not being hit when I place a breakpoint on them.. but I understood that the GetPosition method calls IndexOf which should result in my overriden functions being called.
  <a href="https://www.javaworld.com/article/3305792/comparing-java-objects-with-equals-and-hashcode.html" rel="nofollow noreferrer">https://www.javaworld.com/article/3305792/comparing-java-objects-with-equals-and-hashcode.html</a></p>
  
  <p>In this example, MyClass has one field of Num.. but my code has many more properties in MyClass, all of which are equal between recommendedValue and one of the items in listMyClass.</p>
  
  <p>In InstantiateItem of my ViewPager I call:</p>
  
  <pre><code>var recommendedValue = new MyClass("52");
  var List&lt;MyClass&gt; listMyClass = new List&lt;MyClass&gt; { new MyClass("52"), new MyClass("46") };
  
  mySpinner = view.FindViewById&lt;Spinner&gt;(Resource.Id.mySpinner);
  var myClassAdapter = new MyClassAdapter(view.Context, listMyClass);
  mySpinner.Adapter = myClassAdapter;
  
  //*
  // I need the following to not return -1
  //*
  var recommendedPosition = myClassAdapter.GetPosition((MyClass)recommendedValue);
  </code></pre>
  
  <p>MyClass.cs</p>
  
  <pre><code>public class MyClass: Java.Lang.Object
  {
      private string Num { get; set; } = "";
  
      public MyClass() {}
  
      public MyClass(int? num)
      {
          Num = String.IsNullOrEmpty(num) ? "" : num;
      }
  
      public string GetNum()
      {
          return Num;
      }
  
      public override bool Equals(object other)
      {
          return Equals(other as MyClass);
      }
  
      public bool Equals(MyClass otherItem)
      {
          if (otherItem == null)
          {
              return false;
          }
          return otherItem.Num == Num;
      }
  
      public override int GetHashCode()
      {
          int hash = 19;
          hash = hash * 31 + (Num == null ? 0 : Num.GetHashCode());
          return hash;
      }
  }
  
  </code></pre>