title: Implicit conversion fails when changing struct to sealed class
body: <p>Struct/class in question:</p>
  
  <pre><code>public struct HttpMethod
  {
      public static readonly HttpMethod Get = new HttpMethod("GET");
      public static readonly HttpMethod Post = new HttpMethod("POST");
      public static readonly HttpMethod Put = new HttpMethod("PUT");
      public static readonly HttpMethod Patch = new HttpMethod("PATCH");
      public static readonly HttpMethod Delete = new HttpMethod("DELETE");
  
      private string _name;
  
      public HttpMethod(string name)
      {
          // validation of name
          _name = name.ToUpper();
      }
  
      public static implicit operator string(HttpMethod method)
      {
          return method._name;
      }
  
      public static implicit operator HttpMethod(string method)
      {
          return new HttpMethod(method);
      }
  
      public static bool IsValidHttpMethod(string method)
      {
          // ...
      }
  
      public override bool Equals(object obj)
      {
          // ...
      }
  
      public override int GetHashCode()
      {
          return _name.GetHashCode();
      }
  
      public override string ToString()
      {
          return _name;
      }
  }
  </code></pre>
  
  <p>The following code triggers the issue:</p>
  
  <pre><code>public class HttpRoute
  {
      public string Prefix { get; }
      public HttpMethod[] Methods { get; }
  
      public HttpRoute(string pattern, params HttpMethod[] methods)
      {
          if (pattern == null) throw new ArgumentNullException(nameof(pattern));
          Prefix = pattern;
          Methods = methods ?? new HttpMethod[0];
      }
  
      public bool CanAccept(HttpListenerRequest request)
      {
          return Methods.Contains(request.HttpMethod) &amp;&amp; request.Url.AbsolutePath.StartsWith(Prefix);
      }
  }
  </code></pre>
  
  <p>The compiler error is created by changing the HttpMethod struct into a sealed class. The error is reported for <code>return Methods.Contains(request.HttpMethod)</code>, note: <code>request.HttpMethod</code> in this case is a <code>string</code>. Which produces the following:</p>
  
  <pre><code>Error   CS1929  'HttpMethod[]' does not contain a definition for 'Contains' and the best extension method overload 'Queryable.Contains&lt;string&gt;(IQueryable&lt;string&gt;, string)' requires a receiver of type 'IQueryable&lt;string&gt;'
  </code></pre>
  
  <p>My question is why? I can redesign the code to make it work, but I'm wanting to know why changing from struct to sealed class creates this weird error.</p>
  
  <p><strong>Edit</strong>: Adding a simplified set of example code (available here: <a href="https://dotnetfiddle.net/IZ9OXg" rel="noreferrer">https://dotnetfiddle.net/IZ9OXg</a>). Take note that commenting <em>out</em> the implicit operator to string on the second class allows the code to compile:</p>
  
  <pre><code>public static void Main()
  {
      HttpMethod1[] Methods1 = new HttpMethod1[10];
      HttpMethod2[] Methods2 = new HttpMethod2[10];
  
      var res1 = Methods1.Contains("blah"); //works
      var res2 = Methods2.Contains("blah"); //doesn't work
  }
  
  public struct HttpMethod1
  {
      public static implicit operator HttpMethod1(string method)
      {
          return new HttpMethod1();
      }
  
      public static implicit operator string (HttpMethod1 method)
      {
          return "";
      }
  
  }
  
  public class HttpMethod2
  {
      public static implicit operator HttpMethod2(string method)
      {
          return new HttpMethod2();
      }
  
      //Comment out this method and it works fine
      public static implicit operator string (HttpMethod2 method)
      {
          return "";
      }
  
  }
  </code></pre>